@Override public int numBlips() { return blips.size(); }
@Override public int numReplies() { return replies.size(); }
public void testEmptyList() { assertEquals(0, freshList.size()); }
public void testEmptyList() { assertEquals(0, freshList.size()); }
public void testClear() { assertEquals(0, freshList.size()); freshList.clear(); assertEquals(0, freshList.size()); // TODO(user): Should we have isEmpty? assertFalse(prepopulatedList.size() == 0); prepopulatedList.clear(); assertEquals(0, prepopulatedList.size()); // TODO(user): Add test with parallel removals and additions to cleared list. }
public void testClear() { assertEquals(0, freshList.size()); freshList.clear(); assertEquals(0, freshList.size()); // TODO(user): Should we have isEmpty? assertFalse(prepopulatedList.size() == 0); prepopulatedList.clear(); assertEquals(0, prepopulatedList.size()); // TODO(user): Add test with parallel removals and additions to cleared list. }
public void testPrePopulated() { assertEquals(PREPOPULATED_SIZE, prepopulatedList.size()); for (int i = 0; i < PREPOPULATED_SIZE; ++i) { assertEquals(Integer.toString(i), prepopulatedList.get(i).get()); } }
public void testPrePopulated() { assertEquals(PREPOPULATED_SIZE, prepopulatedList.size()); for (int i = 0; i < PREPOPULATED_SIZE; ++i) { assertEquals(Integer.toString(i), prepopulatedList.get(i).get()); } }
public void testAddAtInvalidIndex() { try { prepopulatedList.add(-1, null); fail("Adding at negative index should fail"); } catch (IndexOutOfBoundsException e) { // success } try { prepopulatedList.add(prepopulatedList.size() + 1,null); fail("Adding after the end of the list should fail"); } catch (IndexOutOfBoundsException e) { // success } }
public void testAddAtInvalidIndex() { try { prepopulatedList.add(-1, null); fail("Adding at negative index should fail"); } catch (IndexOutOfBoundsException e) { // success } try { prepopulatedList.add(prepopulatedList.size() + 1,null); fail("Adding after the end of the list should fail"); } catch (IndexOutOfBoundsException e) { // success } }
public void testAdd() { for (int index = 0; index < WORD.length; ++index) { BasicValue<String> value = freshList.add(null); value.set(WORD[index]); assertEquals("The list should have " + (index + 1) + " elements", index + 1, freshList.size()); assertEquals("The " + (index + 1) + "th value should be " + WORD[index], WORD[index], freshList.get(index).get()); } }
when(blips.indexOf(same(blip))).thenReturn(1); when(blips.remove(same(blip))).thenReturn(true); when(blips.size()).thenReturn(2);
when(threads.indexOf(same(thread))).thenReturn(1); when(threads.remove(same(thread))).thenReturn(true); when(threads.size()).thenReturn(2);
public void testAdd() { for (int index = 0; index < WORD.length; ++index) { BasicValue<String> value = freshList.add(null); value.set(WORD[index]); assertEquals("The list should have " + (index + 1) + " elements", index + 1, freshList.size()); assertEquals("The " + (index + 1) + "th value should be " + WORD[index], WORD[index], freshList.get(index).get()); } }
when(blips.indexOf(same(blip))).thenReturn(1); when(blips.remove(same(blip))).thenReturn(true); when(blips.size()).thenReturn(2);
when(threads.indexOf(same(thread))).thenReturn(1); when(threads.remove(same(thread))).thenReturn(true); when(threads.size()).thenReturn(2);
public void testIndexOf() { for (int i = 0; i < PREPOPULATED_SIZE; ++i) { BasicValue<String> child = prepopulatedList.get(i); assertEquals(i, prepopulatedList.indexOf(child)); } BasicValue<String> last = prepopulatedList.add(null); assertEquals(prepopulatedList.size() - 1, prepopulatedList.indexOf(last)); assertEquals(-1, freshList.indexOf(last)); }
public void testIndexOf() { for (int i = 0; i < PREPOPULATED_SIZE; ++i) { BasicValue<String> child = prepopulatedList.get(i); assertEquals(i, prepopulatedList.indexOf(child)); } BasicValue<String> last = prepopulatedList.add(null); assertEquals(prepopulatedList.size() - 1, prepopulatedList.indexOf(last)); assertEquals(-1, freshList.indexOf(last)); }