Skip to content

Commit

Permalink
Refactored test for decoding passed Path variable
Browse files Browse the repository at this point in the history
  • Loading branch information
dschiese committed Aug 25, 2023
1 parent 4577bbf commit e33e4ae
Showing 1 changed file with 4 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,7 @@ public class QanaryServiceQueryBuilderDateOfDeathDBpediaControllerTest {
private final static String ENDPOINT = "endpoint";
private final static String IN_GRAPH = "inGraph";
private final static String OUT_GRAPH = "outGraph";
private final String encodedQuery = "PREFIX dbo: <http://dbpedia.org/ontology/>\n" +
"PREFIX dct: <http://purl.org/dc/terms/>\n" +
"PREFIX dbr: <http://dbpedia.org/resource/>\n" +
"PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" +
"PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\n" +
"PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n" +
"PREFIX foaf: <http://xmlns.com/foaf/0.1/>\n" +
"\n" +
"SELECT *\n" +
"WHERE\n" +
" { ?resource dbo:deathDate ?answer ;\n" +
" rdfs:label ?label\n" +
" FILTER ( lang(?label) = \"en\" )\n" +
" VALUES ?resource { dbr:Stephen_Hawking }\n" +
" }\n" +
"ORDER BY ?resource\n";

QanaryMessage qanaryMessage;
QanaryQuestion qanaryQuestion;
ResultSet resultSet;
Expand Down Expand Up @@ -185,13 +170,15 @@ List<QuerySolutionMap> addQuerySolutionMapForTupleTestObject(List<TupleTestObjec
@Test
public void testDecodingOfGetDbpediaQueryRequest() throws Exception {
String encodedURI = "http%3A%2F%2Fdbpedia.org%2Fresource%2FStephen_Hawking";
String correctURI = "http://dbpedia.org/resource/Stephen_Hawking";
String expectedQuery = queryBuilderDateOfDeathDBpedia.getDbpediaQuery(correctURI);

MvcResult mvcResult = mockMvc.perform(get("/getdbpediaquery/" + encodedURI))
.andExpect(status().isOk())
.andReturn();


assertEquals(encodedQuery, mvcResult.getResponse().getContentAsString());
assertEquals(expectedQuery, mvcResult.getResponse().getContentAsString());
}

/**
Expand Down

0 comments on commit e33e4ae

Please sign in to comment.