Commit 21014989 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

searching drugs with undefined projectId returns NotFound status

parent 5f5a7fc5
......@@ -46,7 +46,7 @@ public class ChemicalRestImpl extends BaseRestImpl {
throws QueryException {
Model model = getModelService().getLastModelByProjectId(projectId);
if (model == null) {
throw new QueryException("Project with given id doesn't exist");
throw new ObjectNotFoundException("Project with given id doesn't exist");
}
Project project = getProjectService().getProjectByProjectId(projectId);
if (project.getDisease() == null) {
......
......@@ -50,6 +50,18 @@ public class ChemicalControllerIntegrationTest extends ControllerIntegrationTest
.andExpect(status().is2xxSuccessful());
}
@Test
public void testSearchChemicalsInAsteriskProjectId() throws Exception {
MockHttpSession session = createSession(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
RequestBuilder request = get("/projects/*/chemicals:search?query=xyz")
.contentType(MediaType.APPLICATION_FORM_URLENCODED)
.session(session);
mockMvc.perform(request)
.andExpect(status().isNotFound());
}
@Test
public void testgGetSuggestedList() throws Exception {
MockHttpSession session = createSession(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment