Skip to content

Commit

Permalink
Jira Iterator HasNext test
Browse files Browse the repository at this point in the history
Signed-off-by: Maxwell Brown <[email protected]>
  • Loading branch information
Galactus22625 committed Nov 8, 2024
1 parent b9c935a commit 7a85756
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,18 @@ void testItemInfoQueueNotEmpty() {
jiraIterator.setCrawlerQWaitTimeMillis(1);
assertTrue(jiraIterator.hasNext());
assertNotNull(jiraIterator.next());
}

@Test
void testItemInfoQueueEmpty(){
jiraIterator = createObjectUnderTest();
List<IssueBean> mockIssues = new ArrayList<>();
when(mockSearchResults.getIssues()).thenReturn(mockIssues);
when(mockSearchResults.getTotal()).thenReturn(0);
doReturn(mockSearchResults).when(jiraRestClient).getAllIssues(any(StringBuilder.class), anyInt(), any(JiraSourceConfig.class));

jiraIterator.initialize(Instant.ofEpochSecond(0));
jiraIterator.setCrawlerQWaitTimeMillis(1);
assertFalse(jiraIterator.hasNext());
assertThrows(NoSuchElementException.class, () -> jiraIterator.next());
}
Expand Down

0 comments on commit 7a85756

Please sign in to comment.