Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix checkstyle : CypherApiTest #1877

Merged
merged 2 commits into from
May 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,15 @@
import org.junit.Before;
import org.junit.Test;

import com.baidu.hugegraph.testutil.Assert;
import com.google.common.collect.ImmutableMap;

import jakarta.ws.rs.core.Response;

public class CypherApiTest extends BaseApiTest {

private static final String path = URL_PREFIX + "/cypher";
private static final String query = "MATCH (n:person) where n.city ='Beijing' return n";
private static final String queryResult = "Beijing";
private static final String PATH = URL_PREFIX + "/cypher";
private static final String QUERY = "MATCH (n:person) where n.city ='Beijing' return n";
private static final String QUERY_RESULT = "Beijing";

@Before
public void prepareSchema() {
Expand All @@ -49,20 +48,21 @@ public void prepareSchema() {

@Test
public void testGet() {
Map<String, Object> params = ImmutableMap.of("cypher", query);
Response r = client().get(path, params);
Map<String, Object> params = ImmutableMap.of("cypher", QUERY);
Response r = client().get(PATH, params);

this.validStatusAndTextContains(queryResult, r);
this.validStatusAndTextContains(QUERY_RESULT, r);
}

@Test
public void testPost() {
this.testCypherQueryAndContains(query, queryResult);
this.testCypherQueryAndContains(QUERY, QUERY_RESULT);
}

@Test
public void testCreate() {
this.testCypherQueryAndContains("CREATE (n:person { name : 'test', age: 20, city: 'Hefei' }) return n",
this.testCypherQueryAndContains("CREATE (n:person { name : 'test', " +
"age: 20, city: 'Hefei' }) return n",
"Hefei");
}

Expand All @@ -75,7 +75,7 @@ public void testRelationQuery() {
}

private void testCypherQueryAndContains(String cypher, String containsText) {
Response r = client().post(path, cypher);
Response r = client().post(PATH, cypher);
this.validStatusAndTextContains(containsText, r);
}

Expand Down