Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
eingang-manager
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
eingang-manager
Commits
fe0c4ff8
Commit
fe0c4ff8
authored
1 month ago
by
Jan Zickermann
Browse files
Options
Downloads
Patches
Plain Diff
OZG-7978 servicekonto: Cleanup test
parent
f1360a3e
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!18
OZG-7978 servicekonto: Catch runtime-exception in getPostfachAddressType
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
semantik-adapter/src/test/java/de/ozgcloud/eingang/semantik/common/ServiceKontoFactoryTest.java
+19
-22
19 additions, 22 deletions
...loud/eingang/semantik/common/ServiceKontoFactoryTest.java
with
19 additions
and
22 deletions
semantik-adapter/src/test/java/de/ozgcloud/eingang/semantik/common/ServiceKontoFactoryTest.java
+
19
−
22
View file @
fe0c4ff8
...
@@ -31,6 +31,7 @@ import static org.mockito.Mockito.*;
...
@@ -31,6 +31,7 @@ import static org.mockito.Mockito.*;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
org.assertj.core.api.InstanceOfAssertFactories
;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.jupiter.api.DisplayName
;
import
org.junit.jupiter.api.DisplayName
;
import
org.junit.jupiter.api.Nested
;
import
org.junit.jupiter.api.Nested
;
...
@@ -116,7 +117,7 @@ class ServiceKontoFactoryTest {
...
@@ -116,7 +117,7 @@ class ServiceKontoFactoryTest {
}
}
@Test
@Test
void
should
Return
PostfachAddresses
()
{
void
should
Build
PostfachAddresses
()
{
var
addresses
=
getPostfachAddresses
();
var
addresses
=
getPostfachAddresses
();
assertThat
(
addresses
).
hasSize
(
1
);
assertThat
(
addresses
).
hasSize
(
1
);
...
@@ -127,10 +128,10 @@ class ServiceKontoFactoryTest {
...
@@ -127,10 +128,10 @@ class ServiceKontoFactoryTest {
assertThat
(
addresses
.
get
(
0
).
getType
()).
isEqualTo
(
PostfachAddressTestFactory
.
POSTFACH_ADDRESS_TYPE
);
assertThat
(
addresses
.
get
(
0
).
getType
()).
isEqualTo
(
PostfachAddressTestFactory
.
POSTFACH_ADDRESS_TYPE
);
}
}
@DisplayName
(
"should
return
with postfach address type"
)
@DisplayName
(
"should
build
with postfach address type"
)
@ParameterizedTest
@ParameterizedTest
@ValueSource
(
ints
=
{
1
,
2
,
3
})
@ValueSource
(
ints
=
{
1
,
2
,
3
})
void
should
Return
WithPostfachAddressType
(
int
postfachAddressType
)
{
void
should
Build
WithPostfachAddressType
(
int
postfachAddressType
)
{
var
formDataWithPostfachAddressType
=
FormDataUtils
.
from
(
FORM_DATA
)
var
formDataWithPostfachAddressType
=
FormDataUtils
.
from
(
FORM_DATA
)
.
put
(
ServiceKontoFactory
.
REST_RESPONSE_NAME
,
List
.
of
(
Map
.
of
(
.
put
(
ServiceKontoFactory
.
REST_RESPONSE_NAME
,
List
.
of
(
Map
.
of
(
ServiceKontoFactory
.
REST_RESPONSE_NAME_MEMBER_SCOPE
,
ServiceKontoFactory
.
REST_RESPONSE_NAME_MEMBER_SCOPE
,
...
@@ -139,13 +140,12 @@ class ServiceKontoFactoryTest {
...
@@ -139,13 +140,12 @@ class ServiceKontoFactoryTest {
)
)
.
build
();
.
build
();
var
addresses
=
buildServiceKonto
(
formDataWithPostfachAddressType
);
var
serviceKonto
=
buildServiceKonto
(
formDataWithPostfachAddressType
);
var
types
=
addresses
.
getPostfachAddresses
()
assertThat
(
serviceKonto
)
.
stream
()
.
extracting
(
ServiceKonto:
:
getPostfachAddresses
,
InstanceOfAssertFactories
.
list
(
PostfachAddress
.
class
))
.
map
(
PostfachAddress:
:
getType
)
.
extracting
(
PostfachAddress:
:
getType
)
.
toList
();
.
containsExactly
(
postfachAddressType
);
assertThat
(
types
).
containsExactly
(
postfachAddressType
);
}
}
private
List
<
PostfachAddress
>
getPostfachAddresses
()
{
private
List
<
PostfachAddress
>
getPostfachAddresses
()
{
...
@@ -153,34 +153,31 @@ class ServiceKontoFactoryTest {
...
@@ -153,34 +153,31 @@ class ServiceKontoFactoryTest {
}
}
}
}
@DisplayName
(
"with
ba
d rest_response_name"
)
@DisplayName
(
"with
unexpecte
d rest_response_name"
)
@Nested
@Nested
class
TestWith
Ba
dRestResponseName
{
class
TestWith
Unexpecte
dRestResponseName
{
private
final
FormData
formDataWith
Ba
dRestResponseName
=
FormDataUtils
.
from
(
FORM_DATA
)
private
final
FormData
formDataWith
Unexpecte
dRestResponseName
=
FormDataUtils
.
from
(
FORM_DATA
)
.
put
(
ServiceKontoFactory
.
REST_RESPONSE_NAME
,
List
.
of
(
Map
.
of
())).
build
();
.
put
(
ServiceKontoFactory
.
REST_RESPONSE_NAME
,
List
.
of
(
Map
.
of
())).
build
();
@DisplayName
(
"should call buildOsiPostfachV1Address"
)
@DisplayName
(
"should call buildOsiPostfachV1Address"
)
@Test
@Test
void
shouldCallBuildOsiPostfachV1Address
()
{
void
shouldCallBuildOsiPostfachV1Address
()
{
getPostfachAddresses
(
);
buildServiceKonto
(
formDataWithUnexpectedRestResponseName
);
verify
(
factory
).
buildOsiPostfachV1Address
(
any
(),
anyInt
());
verify
(
factory
).
buildOsiPostfachV1Address
(
any
(),
anyInt
());
}
}
@DisplayName
(
"should
return
postfach address with default type"
)
@DisplayName
(
"should
build
postfach address with default type"
)
@Test
@Test
void
should
Return
PostfachAddressWithDefaultType
()
{
void
should
Build
PostfachAddressWithDefaultType
()
{
var
addresses
=
getPostfachAddresses
(
);
var
serviceKonto
=
buildServiceKonto
(
formDataWithUnexpectedRestResponseName
);
assertThat
(
addresses
)
assertThat
(
serviceKonto
)
.
extracting
(
"type"
)
.
extracting
(
ServiceKonto:
:
getPostfachAddresses
,
InstanceOfAssertFactories
.
list
(
PostfachAddress
.
class
))
.
extracting
(
PostfachAddress:
:
getType
)
.
containsExactly
(
POSTFACH_ADDRESS_DEFAULT
);
.
containsExactly
(
POSTFACH_ADDRESS_DEFAULT
);
}
}
private
List
<
PostfachAddress
>
getPostfachAddresses
()
{
return
buildServiceKonto
(
formDataWithBadRestResponseName
).
getPostfachAddresses
();
}
}
}
@DisplayName
(
"without rest_response_name"
)
@DisplayName
(
"without rest_response_name"
)
...
...
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