Source:
<code>public void testFindInArchiveOrWithdrawnDiscoverableModifiedSince() throws Exception { it.setWithdrawn(true); it.setArchived(false); it.setDiscoverable(true); Iterator<Item> all = itemService.findInArchiveOrWithdrawnDiscoverableModifiedSince(context,DateUtils.addDays(it.getLastModified(),1)); <START> assertThat("testFindInArchiveOrWithdrawnDiscoverableModifiedSince 0", all, notNullValue()); <END> boolean added = false; while(all.hasNext()) { Item tmp = all.next(); if(tmp.equals(it)) { added = true; } } assertFalse("testFindInArchiveOrWithdrawnDiscoverableModifiedSince 1", added); all = itemService.findInArchiveOrWithdrawnDiscoverableModifiedSince(context,DateUtils.addDays(it.getLastModified(),-1)); assertThat("testFindInArchiveOrWithdrawnDiscoverableModifiedSince 2", all, notNullValue()); added = false; while(all.hasNext()) { Item tmp = all.next(); if(tmp.equals(it)) { added = true; } } assertTrue("testFindInArchiveOrWithdrawnDiscoverableModifiedSince 3", added); it.setWithdrawn(false); it.setArchived(true); all = itemService.findInArchiveOrWithdrawnDiscoverableModifiedSince(context,DateUtils.addDays(it.getLastModified(),-1)); assertThat("testFindInArchiveOrWithdrawnDiscoverableModifiedSince 4", all, notNullValue()); added = false; while(all.hasNext()) { Item tmp = all.next(); if(tmp.equals(it)) { added = true; } } assertTrue("testFindInArchiveOrWithdrawnDiscoverableModifiedSince 5", added); }</code><technical_language>If assertions fail, helpful for descriptions more "returned list null."</technical_language>

Target:
public void testFindInArchiveOrWithdrawnDiscoverableModifiedSince() throws Exception { it.setWithdrawn(true); it.setArchived(false); it.setDiscoverable(true); Iterator<Item> all = itemService.findInArchiveOrWithdrawnDiscoverableModifiedSince(context,DateUtils.addDays(it.getLastModified(),1)); assertThat("Returned list should not be null", all, notNullValue()); boolean added = false; while(all.hasNext()) { Item tmp = all.next(); if(tmp.equals(it)) { added = true; } } assertFalse("List should not contain item when passing a date newer than item last-modified date", added); all = itemService.findInArchiveOrWithdrawnDiscoverableModifiedSince(context,DateUtils.addDays(it.getLastModified(),-1)); assertThat("Returned list should not be null", all, notNullValue()); added = false; while(all.hasNext()) { Item tmp = all.next(); if(tmp.equals(it)) { added = true; } } assertTrue("List should contain item when passing a date older than item last-modified date", added); it.setWithdrawn(false); it.setArchived(true); all = itemService.findInArchiveOrWithdrawnDiscoverableModifiedSince(context,DateUtils.addDays(it.getLastModified(),-1)); assertThat("Returned list should not be null", all, notNullValue()); added = false; while(all.hasNext()) { Item tmp = all.next(); if(tmp.equals(it)) { added = true; } } assertTrue("List should contain item when passing a date older than item last-modified date", added); it.setDiscoverable(false); all = itemService.findInArchiveOrWithdrawnDiscoverableModifiedSince(context,DateUtils.addDays(it.getLastModified(),-1)); assertThat("Returned list should not be null", all, notNullValue()); added = false; while(all.hasNext()) { Item tmp = all.next(); if(tmp.equals(it)) { added = true; } } assertFalse("List should not contain non-discoverable items", added); }