for (Entry<Long,List<RecommendedItem>> entry : recommendations.entrySet()) {
long userID = entry.getKey();
List<RecommendedItem> items = entry.getValue();
assertNotNull(items);
RecommendedItem item1 = items.get(0);
if (userID == 1L) {
assertEquals(1, items.size());
assertEquals(4L, item1.getItemID());
assertEquals(4.3, item1.getValue(), 0.05);
}
if (userID == 2L) {
assertEquals(1, items.size());
assertEquals(2L, item1.getItemID());
assertEquals(3.3, item1.getValue(), 0.05);
}
if (userID == 3L) {
assertEquals(2, items.size());
assertEquals(3L, item1.getItemID());
assertEquals(4.1, item1.getValue(), 0.05);
RecommendedItem item2 = items.get(1);
assertEquals(1L, item2.getItemID());
assertEquals(3.7, item2.getValue(), 0.05);
}
if (userID == 4L) {
assertEquals(2, items.size());
assertEquals(2L, item1.getItemID());
assertEquals(4.0, item1.getValue(), 0.05);
RecommendedItem item2 = items.get(1);
assertEquals(3L, item2.getItemID());
assertEquals(3.5, item2.getValue(), 0.05);
}
}
}