### Question:
DistanceToNearest extends AbstractOryxResource { @GET @Path("{datum}") @Produces({MediaType.TEXT_PLAIN, "text/csv", MediaType.APPLICATION_JSON}) public String get(@PathParam("datum") String datum) throws OryxServingException { check(datum != null && !datum.isEmpty(), "Data is needed to cluster"); KMeansServingModel model = (KMeansServingModel) getServingModel(); String[] tokens = TextUtils.parseDelimited(datum, ','); return model.closestCluster(KMeansUtils.featuresFromTokens(tokens, model.getInputSchema())).getSecond().toString(); }  @GET @Path("{datum}") @Produces({MediaType.TEXT_PLAIN, "text/csv", MediaType.APPLICATION_JSON}) String get(@PathParam("datum") String datum);  }### Answer:
@Test public void testDistance() { String prediction = target("/distanceToNearest/1,0").request() .accept(MediaType.APPLICATION_JSON_TYPE).get(String.class); Assert.assertEquals(0.0, Double.parseDouble(prediction), OryxTest.DOUBLE_EPSILON); }
@Test public void testDistance2() { String prediction = target("/distanceToNearest/10,-1.0").request().get(String.class); Assert.assertEquals(8.0, Double.parseDouble(prediction), OryxTest.DOUBLE_EPSILON); }