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 14:27:53 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b710d7c24a823c1771a4b73393fa2f6ba8fea2e2
b710d7c2
1 parent
ab477e3e
Nouveaux tests, attention à celui qui est commenté dans PublisherSearchRepositorySolrjTest.
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
1 deletions
src/test/java/org/legrog/entities/PublisherSearchRepositorySolrjTest.java
src/test/java/org/legrog/web/publisher/ListPublisherActionsViewTest.java
src/test/java/org/legrog/entities/PublisherSearchRepositorySolrjTest.java
0 → 100644
View file @
b710d7c
package
org
.
legrog
.
entities
;
import
org.apache.solr.client.solrj.SolrClient
;
import
org.apache.solr.client.solrj.SolrServerException
;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.jupiter.api.DisplayName
;
import
org.junit.jupiter.api.Nested
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.extension.ExtendWith
;
import
org.junit.platform.runner.JUnitPlatform
;
import
org.junit.runner.RunWith
;
import
org.legrog.test.MockitoExtension
;
import
org.mockito.Mock
;
import
org.mockito.Mockito
;
import
java.io.IOException
;
import
static
org
.
mockito
.
Mockito
.
doThrow
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
static
org
.
mockito
.
Mockito
.
when
;
/*
Classe testant PublisherSearchRepositorySolrj
*/
@RunWith
(
JUnitPlatform
.
class
)
@ExtendWith
(
MockitoExtension
.
class
)
@DisplayName
(
"Indexes and searches with SearchRepository"
)
public
class
PublisherSearchRepositorySolrjTest
{
private
PublisherSearchRepository
publisherSearchRepository
;
private
SolrClient
solrClient
;
@BeforeEach
public
void
setup
(
@Mock
SolrClient
solrClient
)
{
publisherSearchRepository
=
new
PublisherSearchRepositorySolrj
(
solrClient
);
this
.
solrClient
=
solrClient
;
}
@Nested
@DisplayName
(
"save method"
)
class
saveTests
{
@Test
@DisplayName
(
"when called should addBean IndexedPublisher with commitWithinMs of 1 to repository"
)
public
void
addBeanTest
(
@Mock
IndexedPublisher
indexedPublisher
)
throws
IndexingException
,
SolrServerException
,
IOException
{
publisherSearchRepository
.
save
(
indexedPublisher
);
verify
(
solrClient
).
addBean
(
indexedPublisher
,
1
);
}
/*
@Test
@DisplayName("When call gets an IOException, should throw an IndexingException cobtaining it")
public void addBeanIOETest(@Mock IndexedPublisher indexedPublisher, @Mock IOException ioException) throws SolrServerException {
IndexingException indexingException = null;
try {
when(solrClient.addBean(indexedPublisher, 1)).thenThrow(ioException);
} catch (IOException e) {
e.printStackTrace();
}
try {
publisherSearchRepository.save(indexedPublisher);
} catch (IndexingException e) {
indexingException = e;
}
verify(ioException).equals(indexingException.getRootCause());
}
*/
}
}
src/test/java/org/legrog/web/publisher/ListPublisherActionsViewTest.java
View file @
b710d7c
...
...
@@ -71,7 +71,7 @@ public class ListPublisherActionsViewTest {
@Test
@DisplayName
(
"when publisher is set, should show only its actions"
)
public
void
testFilter
(
@Mock
PublisherService
publisherServiceMock
)
{
public
void
testFilter
()
{
List
<
PublisherAction
>
publisherActions
=
new
ArrayList
<
PublisherAction
>();
Publisher
publisher
=
new
Publisher
();
...
...
Please
register
or
login
to post a comment