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-12-02 16:59:32 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ac79f06cc6c5cc7d5a1e74013ba9173e5aa045fd
ac79f06c
1 parent
5f601510
sonarQube : Test de vouverture de l'Exception inattendue.
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
1 deletions
src/test/java/org/legrog/web/publisher/PublisherVersionViewTest.java
src/test/java/org/legrog/web/publisher/PublisherVersionViewTest.java
View file @
ac79f06
...
...
@@ -20,6 +20,7 @@ import org.slf4j.LoggerFactory;
import
java.util.List
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertThrows
;
import
static
org
.
mockito
.
ArgumentMatchers
.
any
;
import
static
org
.
mockito
.
ArgumentMatchers
.
anyInt
;
import
static
org
.
mockito
.
Mockito
.
when
;
...
...
@@ -37,7 +38,8 @@ public class PublisherVersionViewTest {
private
PublisherVersion
publisherVersion
;
// TODO tester add et update, mais je ne sais pas comment je suis censé faire
@Mock
PublisherVersion
publisherVersionMock
;
@BeforeEach
public
void
setUp
(
@Mock
PublisherService
publisherService
,
@Mock
SharedService
sharedService
)
throws
Exception
{
...
...
@@ -179,6 +181,23 @@ public class PublisherVersionViewTest {
}
@Nested
@DisplayName
(
"getImmutableValues method"
)
class
getImmutableValuesTests
{
@BeforeEach
@DisplayName
(
"given a way to get a null"
)
public
void
given
(
@Mock
PublisherService
publisherService
)
{
when
(
publisherService
.
addNewPublisher
(
any
())).
thenReturn
(
publisherVersionMock
);
when
(
publisherVersionMock
.
getPublisherVersionId
()).
thenReturn
(
2
);
when
(
publisherService
.
getPublisherVersion
(
2
)).
thenReturn
(
null
);
}
@Test
@DisplayName
(
"throws an IllegalStateException"
)
public
void
testUnexcpetedNull
()
{
assertThrows
(
IllegalStateException
.
class
,
()
->
publisherVersionView
.
add
());
}
}
@Nested
@DisplayName
(
"save method"
)
class
saveTests
{
PublisherVersionView
publisherVersionViewForSave
;
...
...
Please
register
or
login
to post a comment