### Question:
PopularRepresentativeItems extends AbstractALSResource { @GET @Produces({MediaType.TEXT_PLAIN, "text/csv", MediaType.APPLICATION_JSON}) public List<String> get() throws OryxServingException { ALSServingModel model = getALSServingModel(); int features = model.getFeatures(); List<String> items = new ArrayList<>(features); float[] unitVector = new float[features]; for (int i = 0; i < features; i++) { unitVector[i] = 1.0f; Stream<Pair<String,Double>> topIDDot = model.topN(new DotsFunction(unitVector), null, 1, null); items.add(topIDDot.findFirst().map(Pair::getFirst).orElse(null)); unitVector[i] = 0.0f; } return items; }  @GET @Produces({MediaType.TEXT_PLAIN, "text/csv", MediaType.APPLICATION_JSON}) List<String> get();  }### Answer:
@Test public void testPopularRepresentativeItems() { List<String> items = target("/popularRepresentativeItems").request() .accept(MediaType.APPLICATION_JSON_TYPE).get(LIST_STRING_TYPE); Assert.assertEquals(2, items.size()); OryxTest.assertContains(Arrays.asList("I0", "I3"), items.get(0)); Assert.assertEquals("I4", items.get(1)); }
@Test public void testPopularRepresentativeItemsCSV() { String response = target("/popularRepresentativeItems").request().get(String.class); Assert.assertEquals(2, response.split("\n").length); }