ctxt.setVocabularySearcher(searcher);
}
@Test
public void testAddPrefixCommand() throws Exception{
RdfSchema schema = new RdfSchema();
AddPrefixCommand command = new FakeAddPrefixCommand(ctxt,schema);
MockHttpServletRequest request = new MockHttpServletRequest();
MockHttpServletResponse response = new MockHttpServletResponse();
request.addParameter("name", name);
request.addParameter("uri", uri);
request.addParameter("fetch", "web");
request.addParameter("project", projectId);
request.addParameter("fetch-url", uri);
assertFalse(schema.getPrefixesMap().containsKey("foaf"));
assertTrue(searcher.searchClasses("foaf:P", projectId).isEmpty());
command.doPost(request, response);
//verification
//prefix is added to the project
assertTrue(schema.getPrefixesMap().containsKey("foaf"));
//search
assertFalse(searcher.searchClasses("foaf:P", projectId).isEmpty());
}