PAN-52 Fixed issue with the Theorems API

This commit is contained in:
2019-03-21 11:09:01 -06:00
parent 07cdef3d44
commit d0cde837e9
2 changed files with 3 additions and 5 deletions
@@ -119,10 +119,8 @@ public class TheoremController {
return new ResponseEntity<>(HttpStatus.BAD_REQUEST); return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
} }
name = name.toLowerCase();
if (name.contains("_") || name.contains("-")) { if (name.contains("_") || name.contains("-")) {
name = name.replace("-", " "); name = name.replace("_", " ");
name = name.replace("-", " "); name = name.replace("-", " ");
} }
@@ -184,7 +184,7 @@ public class TheoremControllerTest {
when(theoremRepository.findByName(anyString())).thenReturn(listOfTheorems); when(theoremRepository.findByName(anyString())).thenReturn(listOfTheorems);
final ResponseEntity<List<Theorem>> responseEntity = theoremController.getAllTheoremsByName("Test Theorem"); final ResponseEntity<List<Theorem>> responseEntity = theoremController.getAllTheoremsByName("Test_Theorem");
assertNotNull(responseEntity); assertNotNull(responseEntity);
assertEquals(HttpStatus.OK, responseEntity.getStatusCode()); assertEquals(HttpStatus.OK, responseEntity.getStatusCode());
@@ -208,7 +208,7 @@ public class TheoremControllerTest {
public void testGetAllTheoremsByName_noNameFound() { public void testGetAllTheoremsByName_noNameFound() {
when(theoremRepository.findByName(anyString())).thenReturn(Collections.emptyList()); when(theoremRepository.findByName(anyString())).thenReturn(Collections.emptyList());
final ResponseEntity<List<Theorem>> responseEntity = theoremController.getAllTheoremsByName("No name"); final ResponseEntity<List<Theorem>> responseEntity = theoremController.getAllTheoremsByName("No-name");
assertNotNull(responseEntity); assertNotNull(responseEntity);
assertFalse(responseEntity.hasBody()); assertFalse(responseEntity.hasBody());