### Question:
EstimateForAnonymous extends AbstractALSResource { @GET @Path("{toItemID}/{itemID : .+}") @Produces({MediaType.TEXT_PLAIN, "text/csv", MediaType.APPLICATION_JSON}) public Double get( @PathParam("toItemID") String toItemID, @PathParam("itemID") List<PathSegment> pathSegments) throws OryxServingException { ALSServingModel model = getALSServingModel(); float[] toItemVector = model.getItemVector(toItemID); checkExists(toItemVector != null, toItemID); float[] anonymousUserFeatures = buildTemporaryUserVector(model, parsePathSegments(pathSegments), null); return anonymousUserFeatures == null ? 0.0 : VectorMath.dot(anonymousUserFeatures, toItemVector); }  @GET @Path("{toItemID}/{itemID : .+}") @Produces({MediaType.TEXT_PLAIN, "text/csv", MediaType.APPLICATION_JSON}) Double get(
      @PathParam("toItemID") String toItemID,
      @PathParam("itemID") List<PathSegment> pathSegments);  }### Answer:
@Test public void testEstimateForAnonymous() { Double item = target("/estimateForAnonymous/I7/I4=1.0/I5=2.0").request() .accept(MediaType.APPLICATION_JSON_TYPE).get(Double.class); Assert.assertEquals(0.3596476256862573, item, DOUBLE_EPSILON); }
@Test public void testEstimateForAnonymousWithUnknown() { Double item = target("/estimateForAnonymous/I3/foo/I4=1.0/I5=2.0").request() .accept(MediaType.APPLICATION_JSON_TYPE).get(Double.class); Assert.assertEquals(-0.0670749299183302, item, DOUBLE_EPSILON); }
@Test public void testEstimateForAnonymousWithAllUnknown() { Double item = target("/estimateForAnonymous/I3/foo").request() .accept(MediaType.APPLICATION_JSON_TYPE).get(Double.class); Assert.assertEquals(0.0, item, DOUBLE_EPSILON); }
@Test public void testEstimateForAnonymousCSV() { String response = target("/estimateForAnonymous/I3/I4=1.0/I5=2.0").request() .get(String.class); Assert.assertEquals(-0.0670749299183302, Double.parseDouble(response), DOUBLE_EPSILON); }
@Test(expected = NotFoundException.class) public void testBadRequest() { target("/estimateForAnonymous").request().get(String.class); }
@Test(expected = NotFoundException.class) public void testUnknownUser() { target("/estimateForAnonymous/foo").request().get(String.class); }