@Test
public void testBinarySearch() throws Exception {

    final long[] values = {2, 3, 4, 6, 9, 11, 12};
    // value in array
    assertEquals(0, ObservationFinder.binarySearch(values, 2));
    assertEquals(1, ObservationFinder.binarySearch(values, 3));
    assertEquals(2, ObservationFinder.binarySearch(values, 4));
    assertEquals(3, ObservationFinder.binarySearch(values, 6));
    assertEquals(4, ObservationFinder.binarySearch(values, 9));
    assertEquals(5, ObservationFinder.binarySearch(values, 11));
    assertEquals(6, ObservationFinder.binarySearch(values, 12));
    // value in range of array values
    assertEquals(2, ObservationFinder.binarySearch(values, 5));
    assertEquals(3, ObservationFinder.binarySearch(values, 7));
    assertEquals(3, ObservationFinder.binarySearch(values, 8));
    assertEquals(4, ObservationFinder.binarySearch(values, 10));
    // values greater than the greatest value in array
    assertEquals(6, ObservationFinder.binarySearch(values, 13));
    assertEquals(6, ObservationFinder.binarySearch(values, 14));
    // values less than the least value in array
    assertEquals(-1, ObservationFinder.binarySearch(values, 0));
    assertEquals(-1, ObservationFinder.binarySearch(values, 1));
}