}
@Test
public void testFileItemItemSimilarityIterable() throws Exception {
Iterable<ItemItemSimilarity> similarityIterable = new FileItemItemSimilarityIterable(testFile);
GenericItemSimilarity similarity = new GenericItemSimilarity(similarityIterable);
assertEquals(0.125, similarity.itemSimilarity(1L, 5L), EPSILON);
assertEquals(0.125, similarity.itemSimilarity(5L, 1L), EPSILON);
assertEquals(0.5, similarity.itemSimilarity(1L, 7L), EPSILON);
assertEquals(0.5, similarity.itemSimilarity(7L, 1L), EPSILON);
assertTrue(Double.isNaN(similarity.itemSimilarity(7L, 8L)));
double[] valuesForOne = similarity.itemSimilarities(1L, new long[] { 5L, 7L });
assertNotNull(valuesForOne);
assertEquals(2, valuesForOne.length);
assertEquals(0.125, valuesForOne[0], EPSILON);
assertEquals(0.5, valuesForOne[1], EPSILON);
}