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
JR Utily
2017-02-07 00:06:09 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
38d0c5468d532af998712a4e2d1863589948c148
38d0c546
1 parent
b710d7c2
fix tests
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
22 deletions
src/test/java/org/legrog/entities/PublisherSearchRepositorySolrjTest.java
src/test/java/org/legrog/entities/PublisherSearchRepositorySolrjTest.java
View file @
38d0c54
...
...
@@ -2,20 +2,15 @@ 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.*
;
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
;
...
...
@@ -25,6 +20,7 @@ import static org.mockito.Mockito.when;
@RunWith
(
JUnitPlatform
.
class
)
@ExtendWith
(
MockitoExtension
.
class
)
@DisplayName
(
"Indexes and searches with SearchRepository"
)
public
class
PublisherSearchRepositorySolrjTest
{
private
PublisherSearchRepository
publisherSearchRepository
;
...
...
@@ -38,7 +34,7 @@ public class PublisherSearchRepositorySolrjTest {
@Nested
@DisplayName
(
"save method"
)
class
saveTests
{
class
saveTests
{
@Test
@DisplayName
(
"when called should addBean IndexedPublisher with commitWithinMs of 1 to repository"
)
...
...
@@ -46,24 +42,14 @@ public class PublisherSearchRepositorySolrjTest {
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());
public
void
addBeanIOETest
(
@Mock
IndexedPublisher
indexedPublisher
)
throws
SolrServerException
,
IOException
{
when
(
solrClient
.
addBean
(
indexedPublisher
,
1
)).
thenThrow
(
new
IOException
());
Assertions
.
assertThrows
(
IndexingException
.
class
,
()
->
publisherSearchRepository
.
save
(
indexedPublisher
));
}
*/
}
}
...
...
Please
register
or
login
to post a comment