Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
administration
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OZG-Cloud
app
administration
Commits
38068155
Commit
38068155
authored
1 year ago
by
OZGCloud
Browse files
Options
Downloads
Patches
Plain Diff
OZG-4717 PR#23 Comments
parent
d84fc6ae
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/java/de/ozgcloud/admin/common/errorhandling/ExceptionControllerITCase.java
+4
-5
4 additions, 5 deletions
...admin/common/errorhandling/ExceptionControllerITCase.java
with
4 additions
and
5 deletions
src/test/java/de/ozgcloud/admin/common/errorhandling/ExceptionControllerITCase.java
+
4
−
5
View file @
38068155
...
@@ -38,7 +38,7 @@ import lombok.SneakyThrows;
...
@@ -38,7 +38,7 @@ import lombok.SneakyThrows;
@ITCase
@ITCase
@AutoConfigureMockMvc
@AutoConfigureMockMvc
@WithMockUser
@WithMockUser
public
class
ExceptionControllerITCase
{
class
ExceptionControllerITCase
{
@Autowired
@Autowired
private
MockMvc
mockMvc
;
private
MockMvc
mockMvc
;
...
@@ -82,8 +82,7 @@ public class ExceptionControllerITCase {
...
@@ -82,8 +82,7 @@ public class ExceptionControllerITCase {
@SneakyThrows
@SneakyThrows
void
shouldHaveInfoInBody
()
{
void
shouldHaveInfoInBody
()
{
when
(
modelAssembler
.
toModel
(
any
())).
thenAnswer
((
a
)
->
{
when
(
modelAssembler
.
toModel
(
any
())).
thenAnswer
((
a
)
->
{
var
validationObject
=
ValidatedClass
.
builder
().
build
();
throw
new
ConstraintViolationException
(
getConstraintViolations
());
throw
new
ConstraintViolationException
(
getConstraintViolations
(
validationObject
));
});
});
var
result
=
performGet
();
var
result
=
performGet
();
...
@@ -91,9 +90,9 @@ public class ExceptionControllerITCase {
...
@@ -91,9 +90,9 @@ public class ExceptionControllerITCase {
assertThat
(
result
.
andReturn
().
getResponse
().
getContentAsString
()).
contains
(
"string: Empty field"
);
assertThat
(
result
.
andReturn
().
getResponse
().
getContentAsString
()).
contains
(
"string: Empty field"
);
}
}
private
<
T
>
Set
<
ConstraintViolation
<
T
>>
getConstraintViolations
(
T
object
)
{
private
Set
<
ConstraintViolation
<
ValidatedClass
>>
getConstraintViolations
()
{
Validator
validator
=
Validation
.
buildDefaultValidatorFactory
().
getValidator
();
Validator
validator
=
Validation
.
buildDefaultValidatorFactory
().
getValidator
();
return
validator
.
validate
(
object
);
return
validator
.
validate
(
ValidatedClass
.
builder
().
build
()
);
}
}
@Getter
@Getter
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment