@Test
public void testBinSearch() {

	ContextExtractor extractor = new ContextExtractor(
			"diego ceccarelli prova test pippo pluto belen");
	List<Integer> test = Arrays.asList(new Integer[] { 1, 5, 10, 50, 100,
			110 });
	assertEquals(0, extractor.closest(2, test));
	assertEquals(0, extractor.closest(3, test));
	assertEquals(0, extractor.closest(4, test));
	assertEquals(1, extractor.closest(5, test));
	assertEquals(4, extractor.closest(105, test));
	assertEquals(5, extractor.closest(120, test));
	assertEquals(3, extractor.closest(99, test));
	test = Arrays.asList(new Integer[] { 0, 1 });
	assertEquals(1, extractor.closest(10000, test));
	assertEquals(0, extractor.closest(0, test));
	test = Arrays.asList(new Integer[] { 0, 1 });
	assertEquals(1, extractor.closest(10000, test));
	assertEquals(0, extractor.closest(0, test));
	test = Arrays.asList(new Integer[] { 1, 5, 10, 50, 100, 110, 1000 });
	assertEquals(0, extractor.closest(2, test));
	assertEquals(0, extractor.closest(3, test));
	assertEquals(0, extractor.closest(4, test));
	assertEquals(1, extractor.closest(5, test));
	assertEquals(4, extractor.closest(105, test));
	assertEquals(5, extractor.closest(120, test));
	assertEquals(6, extractor.closest(1000, test));
	assertEquals(6, extractor.closest(10000, test));
}