### Question:
CellTimestampComparator implements Comparator<Cell> { public int compare(Cell o1, Cell o2) { return Long.valueOf(o1.getTimestamp()).compareTo(o2.getTimestamp()); }  int compare(Cell o1, Cell o2);  }### Answer:
@Test public void test_less() { Cell cell1 = Mockito.mock(Cell.class); Mockito.when(cell1.getTimestamp()).thenReturn(13945345808L); Cell cell2 = Mockito.mock(Cell.class); Mockito.when(cell2.getTimestamp()).thenReturn(13845345808L); CellTimestampComparator comparator = new CellTimestampComparator(); Assert.assertTrue(comparator.compare(cell2, cell1) == -1); }
@Test public void test_greater() { Cell cell1 = Mockito.mock(Cell.class); Mockito.when(cell1.getTimestamp()).thenReturn(13745345808L); Cell cell2 = Mockito.mock(Cell.class); Mockito.when(cell2.getTimestamp()).thenReturn(13945345808L); CellTimestampComparator comparator = new CellTimestampComparator(); Assert.assertTrue(comparator.compare(cell2, cell1) == 1); }
@Test public void test_equal() { Cell cell1 = Mockito.mock(Cell.class); Mockito.when(cell1.getTimestamp()).thenReturn(13945345808L); Cell cell2 = Mockito.mock(Cell.class); Mockito.when(cell2.getTimestamp()).thenReturn(13945345808L); CellTimestampComparator comparator = new CellTimestampComparator(); Assert.assertTrue(comparator.compare(cell2, cell1) == 0); }