### Question:
PackedRatingMatrix implements RatingMatrix { @Override public KeyIndex userIndex() { requireValid(); return data.getUserIndex(); } PackedRatingMatrix(PackedRatingData data); @Override LongCollection getUserIds(); @Override LongCollection getItemIds(); @Override KeyIndex userIndex(); @Override KeyIndex itemIndex(); @Override List<RatingMatrixEntry> getRatings(); @Override Collection<RatingMatrixEntry> getUserRatings(long userId); @Override synchronized Long2DoubleMap getUserRatingVector(long userId); @PreDestroy void dispose();  }### Answer:
@Test public void testUserIndex() { KeyIndex ind = snap.userIndex(); assertEquals(6, ind.size()); assertTrue(ind.getKeyList().contains(1)); assertTrue(ind.getKeyList().contains(3)); assertTrue(ind.getKeyList().contains(4)); assertTrue(ind.getKeyList().contains(5)); assertTrue(ind.getKeyList().contains(6)); assertTrue(ind.getKeyList().contains(7)); assertEquals(0, ind.getIndex(1)); assertEquals(1, ind.getIndex(3)); assertEquals(2, ind.getIndex(4)); assertEquals(3, ind.getIndex(5)); assertEquals(4, ind.getIndex(6)); assertEquals(5, ind.getIndex(7)); assertEquals(1, ind.getKey(0)); assertEquals(3, ind.getKey(1)); assertEquals(4, ind.getKey(2)); assertEquals(5, ind.getKey(3)); assertEquals(6, ind.getKey(4)); assertEquals(7, ind.getKey(5)); }