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
2016-11-23 14:16:05 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
8e6aa244abba5f7d92586b8c8733c0172ce0e656
8e6aa244
1 parent
0232c878
Test de la méthode derrière le bouton save et simplification code de test.
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
14 deletions
src/test/java/org/legrog/web/publisher/PublisherVersionViewTest.java
src/test/java/org/legrog/web/publisher/PublisherVersionViewTest.java
View file @
8e6aa24
...
...
@@ -83,19 +83,6 @@ public class PublisherVersionViewTest {
public
void
testCancelNewPublisher
()
{
publisherVersionView
.
setNewPublisher
(
true
);
publisherVersionView
.
setPublisherName
(
"A"
);
publisherVersionView
.
setPublisherStreetAddress
(
"B"
);
publisherVersionView
.
setPublisherPostalCode
(
"C"
);
publisherVersionView
.
setPublisherPostOfficeBoxNumber
(
"D"
);
publisherVersionView
.
setPublisherAddressRegion
(
"E"
);
publisherVersionView
.
setPublisherAddressLocality
(
"F"
);
publisherVersionView
.
setPublisherAddressCountry
(
new
Country
());
publisherVersionView
.
setPublisherTelephone
(
"G"
);
publisherVersionView
.
setPublisherEmail
(
"H"
);
publisherVersionView
.
setPublisherURL
(
"I"
);
publisherVersionView
.
setPublisherActive
(
true
);
publisherVersionView
.
setPublisherHistory
(
"J"
);
publisherVersionView
.
cancel
();
assertThat
(
publisherVersionView
.
getPublisherName
()).
isNull
();
...
...
@@ -178,6 +165,49 @@ public class PublisherVersionViewTest {
}
@Nested
@DisplayName
(
"save method"
)
class
saveTests
{
PublisherVersionView
publisherVersionViewForSave
;
public
boolean
addCalled
=
false
;
public
boolean
updateCalled
=
false
;
@BeforeEach
@DisplayName
(
"Given some test reimplementation"
)
public
void
given
()
{
publisherVersionViewForSave
=
new
PublisherVersionView
()
{
@Override
public
void
add
()
{
addCalled
=
true
;
}
@Override
public
void
update
()
{
updateCalled
=
true
;
}
};
}
@Test
@DisplayName
(
"Test should call add on new publisher"
)
public
void
testSaveAdd
()
{
publisherVersionViewForSave
.
setNewPublisher
(
true
);
publisherVersionViewForSave
.
save
();
assertThat
(
addCalled
).
isTrue
();
}
@Test
@DisplayName
(
"Test should call update on old publisher"
)
public
void
testSaveUpdate
()
{
publisherVersionViewForSave
.
setNewPublisher
(
false
);
publisherVersionViewForSave
.
save
();
assertThat
(
updateCalled
).
isTrue
();
}
}
@Nested
@DisplayName
(
"post construct method"
)
class
init
{
...
...
@@ -288,7 +318,6 @@ public class PublisherVersionViewTest {
publisherVersionView
.
setPublisherURL
(
"I"
);
publisherVersionView
.
setPublisherActive
(
true
);
publisherVersionView
.
setPublisherHistory
(
"J"
);
// WHY, JR ?
publisherVersionView
.
setPublisher
(
publisherMock
);
}
...
...
Please
register
or
login
to post a comment