Skip to content

Commit

Permalink
fix: Jaccard Similarity api test
Browse files Browse the repository at this point in the history
  • Loading branch information
DanGuge committed Jul 28, 2023
1 parent c6ab9f4 commit c7825a6
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@

import java.util.Map;

import jakarta.ws.rs.core.Response;
import org.apache.hugegraph.api.BaseApiTest;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import org.apache.hugegraph.api.BaseApiTest;
import com.google.common.collect.ImmutableMap;

import jakarta.ws.rs.core.Response;

public class JaccardSimilarityApiTest extends BaseApiTest {

static final String PATH = TRAVERSERS_API + "/jaccardsimilarity";
Expand Down Expand Up @@ -72,9 +73,10 @@ public void testPost() {
"\"top\": 3}", markoId);
Response r = client().post(PATH, reqBody);
String content = assertResponseStatus(200, r);
Double rippleJaccardSimilarity = assertJsonContains(content, rippleId);
Double peterJaccardSimilarity = assertJsonContains(content, peterId);
Double jsonJaccardSimilarity = assertJsonContains(content, jsonId);
Map<?, ?> jaccardSimilarity = assertJsonContains(content, "jaccard_similarity");
Double rippleJaccardSimilarity = assertMapContains(jaccardSimilarity, rippleId);
Double peterJaccardSimilarity = assertMapContains(jaccardSimilarity, peterId);
Double jsonJaccardSimilarity = assertMapContains(jaccardSimilarity, jsonId);
Assert.assertEquals(0.3333, rippleJaccardSimilarity.doubleValue(),
0.0001);
Assert.assertEquals(0.25, peterJaccardSimilarity.doubleValue(), 0.0001);
Expand Down

0 comments on commit c7825a6

Please sign in to comment.