@Test public void testOccurences() throws Exception { Integer[] duplicated = new Integer[] {1, 2, 3, 4, 4, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 13, 13}; assertEquals(3, Search.occurences(duplicated, 4)); assertEquals(3, Search.occurences(duplicated, 13)); }
@Test public void testOccurencesNoDuplicates() throws Exception { assertEquals(0, Search.occurences(sorted, 10)); assertEquals(1, Search.occurences(sorted, 4)); }