Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
alfa
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
alfa
Commits
d37f14e1
Commit
d37f14e1
authored
4 months ago
by
Felix Reichenbach
Browse files
Options
Downloads
Patches
Plain Diff
OZG-7474 apply code review comments
parent
ec78a8cb
No related branches found
No related tags found
1 merge request
!11
OZG-7474 OZG-7610 add forward by ozg cloud link, move forward by email into new processor
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
alfa-service/src/test/java/de/ozgcloud/alfa/vorgang/forwarding/ForwardingVorgangWithEingangProcessorTest.java
+20
-10
20 additions, 10 deletions
...forwarding/ForwardingVorgangWithEingangProcessorTest.java
with
20 additions
and
10 deletions
alfa-service/src/test/java/de/ozgcloud/alfa/vorgang/forwarding/ForwardingVorgangWithEingangProcessorTest.java
+
20
−
10
View file @
d37f14e1
...
@@ -5,7 +5,6 @@ import static org.mockito.ArgumentMatchers.*;
...
@@ -5,7 +5,6 @@ import static org.mockito.ArgumentMatchers.*;
import
static
org
.
mockito
.
Mockito
.*;
import
static
org
.
mockito
.
Mockito
.*;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.jupiter.api.DisplayName
;
import
org.junit.jupiter.api.Nested
;
import
org.junit.jupiter.api.Nested
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.params.ParameterizedTest
;
import
org.junit.jupiter.params.ParameterizedTest
;
...
@@ -67,6 +66,8 @@ class ForwardingVorgangWithEingangProcessorTest {
...
@@ -67,6 +66,8 @@ class ForwardingVorgangWithEingangProcessorTest {
@Test
@Test
void
shouldCallIsForwardableByOzgCloud
()
{
void
shouldCallIsForwardableByOzgCloud
()
{
doReturn
(
false
).
when
(
processor
).
isForwardableByOzgCloud
(
any
());
processor
.
process
(
EntityModel
.
of
(
vorgang
));
processor
.
process
(
EntityModel
.
of
(
vorgang
));
verify
(
processor
).
isForwardableByOzgCloud
(
vorgang
);
verify
(
processor
).
isForwardableByOzgCloud
(
vorgang
);
...
@@ -74,6 +75,7 @@ class ForwardingVorgangWithEingangProcessorTest {
...
@@ -74,6 +75,7 @@ class ForwardingVorgangWithEingangProcessorTest {
@Nested
@Nested
class
TestOnIsNotForwardableByOzgCloud
{
class
TestOnIsNotForwardableByOzgCloud
{
@BeforeEach
@BeforeEach
void
givenIsNotForwardableByOzgCloud
()
{
void
givenIsNotForwardableByOzgCloud
()
{
doReturn
(
false
).
when
(
processor
).
isForwardableByOzgCloud
(
any
());
doReturn
(
false
).
when
(
processor
).
isForwardableByOzgCloud
(
any
());
...
@@ -89,6 +91,7 @@ class ForwardingVorgangWithEingangProcessorTest {
...
@@ -89,6 +91,7 @@ class ForwardingVorgangWithEingangProcessorTest {
@Nested
@Nested
class
TestOnIsForwardableByOzgCloud
{
class
TestOnIsForwardableByOzgCloud
{
@BeforeEach
@BeforeEach
void
givenIsNotForwardableByOzgCloud
()
{
void
givenIsNotForwardableByOzgCloud
()
{
doReturn
(
true
).
when
(
processor
).
isForwardableByOzgCloud
(
any
());
doReturn
(
true
).
when
(
processor
).
isForwardableByOzgCloud
(
any
());
...
@@ -111,33 +114,40 @@ class ForwardingVorgangWithEingangProcessorTest {
...
@@ -111,33 +114,40 @@ class ForwardingVorgangWithEingangProcessorTest {
@Nested
@Nested
class
TestForwardingLink
{
class
TestForwardingLink
{
@DisplayName
(
"should NOT be present in other Role then EA"
)
@Test
void
shouldCallUserServiceForCurrentRole
()
{
processor
.
process
(
EntityModel
.
of
(
VorgangWithEingangTestFactory
.
create
()));
verify
(
userService
).
hasRole
(
UserRole
.
EINHEITLICHER_ANSPRECHPARTNER
);
}
@ParameterizedTest
@ParameterizedTest
@EnumSource
@EnumSource
void
shouldNotBePresentWithoutRole
(
Vorgang
.
VorgangStatus
status
)
{
void
shouldNotBePresentWithoutRole
(
Vorgang
.
VorgangStatus
status
)
{
when
(
userService
.
hasRole
(
UserRole
.
EINHEITLICHER_ANSPRECHPARTNER
)).
thenReturn
(
false
);
when
(
userService
.
hasRole
(
any
()
)).
thenReturn
(
false
);
var
link
=
processor
.
process
(
buildVorgangInStatus
(
status
)).
getLink
(
ForwardingVorgangWithEingangProcessor
.
REL_FORWARD_BY_EMAIL
);
var
link
=
processor
.
process
(
buildVorgangInStatus
(
status
)).
getLink
(
ForwardingVorgangWithEingangProcessor
.
REL_FORWARD_BY_EMAIL
);
assertThat
(
link
).
isEmpty
();
assertThat
(
link
).
isEmpty
();
}
}
@DisplayName
(
"with role EinheitlicherAnsprechpartner"
)
@Nested
@Nested
class
TestWithRoleEinheitlicherAnsprechpartner
{
class
TestWithRoleEinheitlicherAnsprechpartner
{
@BeforeEach
@BeforeEach
void
init
()
{
void
init
()
{
when
(
userService
.
hasRole
(
UserRole
.
EINHEITLICHER_ANSPRECHPARTNER
)).
thenReturn
(
true
);
when
(
userService
.
hasRole
(
any
()
)).
thenReturn
(
true
);
}
}
@DisplayName
(
"should be present in any Status"
)
@ParameterizedTest
@ParameterizedTest
@EnumSource
()
@EnumSource
void
shouldBePresent
(
VorgangStatus
status
)
{
void
shouldBePresentOnAnyStatus
(
VorgangStatus
status
)
{
var
expectedHref
=
UriComponentsBuilder
.
fromUriString
(
ForwardingController
.
LIST_PATH
)
.
queryParam
(
ForwardingController
.
PARAM_VORGANG_ID
,
VorgangHeaderTestFactory
.
ID
).
build
().
toString
();
var
link
=
processor
.
process
(
buildVorgangInStatus
(
status
)).
getLink
(
ForwardingVorgangWithEingangProcessor
.
REL_FORWARD_BY_EMAIL
);
var
link
=
processor
.
process
(
buildVorgangInStatus
(
status
)).
getLink
(
ForwardingVorgangWithEingangProcessor
.
REL_FORWARD_BY_EMAIL
);
assertThat
(
link
).
isPresent
().
get
().
extracting
(
Link:
:
getHref
)
assertThat
(
link
).
isPresent
().
get
().
extracting
(
Link:
:
getHref
).
isEqualTo
(
expectedHref
);
.
isEqualTo
(
"/api/forwardings?vorgangId="
+
VorgangHeaderTestFactory
.
ID
);
}
}
}
}
...
...
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