Toggle navigation
Toggle navigation
This project
Loading...
Sign in
grogv3
/
grog-cubi
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Jean-Francois Leveque
2017-02-06 10:40:33 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
abce70cbaf8bc4afe61ae4b0a511de510dba96b2
abce70cb
1 parent
e0d8c33c
Passage en when/should et ajout d'assertions.
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
8 deletions
src/test/java/org/legrog/web/publisher/PublisherVersionViewTest.java
src/test/java/org/legrog/web/publisher/PublisherVersionViewTest.java
View file @
abce70c
...
...
@@ -37,12 +37,16 @@ public class PublisherVersionViewTest {
private
PublisherVersionView
publisherVersionView
;
private
PublisherVersion
publisherVersion
;
private
PublisherService
publisherService
;
private
SharedService
sharedService
;
@Mock
PublisherVersion
publisherVersionMock
;
@BeforeEach
public
void
setUp
(
@Mock
PublisherService
publisherService
,
@Mock
SharedService
sharedService
)
throws
Exception
{
this
.
publisherService
=
publisherService
;
this
.
sharedService
=
sharedService
;
publisherVersionView
=
new
PublisherVersionView
(
publisherService
,
sharedService
);
publisherVersionView
.
setEditMode
(
false
);
publisherVersionView
.
setNewPublisher
(
false
);
...
...
@@ -66,12 +70,14 @@ public class PublisherVersionViewTest {
}
@Test
@DisplayName
(
"
depends on
Shared Service and Publisher Service"
)
@DisplayName
(
"
when constructed, should have right dependencies :
Shared Service and Publisher Service"
)
public
void
testDependencies
()
{
assertThat
(
publisherVersionView
).
isNotNull
();
assertThat
(
publisherVersionView
.
publisherService
).
isEqualTo
(
publisherService
);
assertThat
(
publisherVersionView
.
sharedService
).
isEqualTo
(
sharedService
);
}
@DisplayName
(
"
Switches
to edit mode"
)
@DisplayName
(
"
when edit is clicked, should switch
to edit mode"
)
@Test
public
void
testEdit
()
{
assertThat
(
publisherVersionView
.
isEditMode
()).
isFalse
();
...
...
@@ -79,7 +85,7 @@ public class PublisherVersionViewTest {
assertThat
(
publisherVersionView
.
isEditMode
()).
isTrue
();
}
@DisplayName
(
"
Cleans new form data on cancel
"
)
@DisplayName
(
"
when cancel is clicked for an new publisher, should clean new form data and switch to non-edit mode
"
)
@Test
public
void
testCancelNewPublisher
()
{
publisherVersionView
.
setNewPublisher
(
true
);
...
...
@@ -99,7 +105,7 @@ public class PublisherVersionViewTest {
assertThat
(
publisherVersionView
.
isEditMode
()).
isTrue
();
}
@DisplayName
(
"
Reverts to original data of version on canceled updat
e"
)
@DisplayName
(
"
whan cancel is clicked for a publisher update, should revert to original data and switch to non-edit mod
e"
)
@Test
public
void
testCancelNewVersionOfPublisher
()
{
publisherVersionView
.
setNewPublisher
(
false
);
...
...
@@ -146,7 +152,7 @@ public class PublisherVersionViewTest {
}
@Test
@DisplayName
(
"
Loads data from existing version
into the form"
)
@DisplayName
(
"
when called for existing publisher, should get the rigtht data
into the form"
)
public
void
testLoadData
()
{
publisherVersionView
.
setNewPublisher
(
true
);
publisherVersionView
.
setPublisherVersionId
(
1
);
...
...
@@ -165,7 +171,7 @@ public class PublisherVersionViewTest {
}
@Test
@DisplayName
(
"
Sets default value in
form for new version"
)
@DisplayName
(
"
when called for new publisher, should set
form for new version"
)
public
void
testLoadDataEmpty
()
{
publisherVersionView
.
setNewPublisher
(
false
);
publisherVersionView
.
setPublisherVersionId
(
0
);
...
...
@@ -298,7 +304,7 @@ public class PublisherVersionViewTest {
publisherVersionView
.
update
();
}
@DisplayName
(
"should add a new version to apublisher"
)
@DisplayName
(
"should add a new version to a
publisher"
)
@Test
public
void
shouldAddNewVersion
(
@Mock
PublisherService
publisherService
)
{
Mockito
.
verify
(
publisherService
).
addVersionToPublisher
(
publisherArgumentCaptor
.
capture
(),
publisherVersionArgumentCaptor
.
capture
());
...
...
@@ -366,7 +372,7 @@ public class PublisherVersionViewTest {
publisherVersionView
.
add
();
}
@DisplayName
(
"should create
in the application a new publisher
with its first version"
)
@DisplayName
(
"should create
a new publisher in the application
with its first version"
)
@Test
public
void
shouldSave
(
@Mock
PublisherService
publisherService
)
{
Mockito
.
verify
(
publisherService
).
addNewPublisher
(
publisherVersionArgumentCaptor
.
capture
());
...
...
Please
register
or
login
to post a comment