PAN-52 Fixed issue with the Theorems API

This commit is contained in:
2019-03-21 11:05:32 -06:00
parent ab360abcf8
commit 07cdef3d44
2 changed files with 6 additions and 6 deletions
@@ -53,8 +53,8 @@ public class TheoremController {
}
if (branch.contains("_") || branch.contains("-")) {
branch = branch.replace("_", "\\s");
branch = branch.replace("-", "\\s");
branch = branch.replace("_", " ");
branch = branch.replace("-", " ");
}
LOG.debug("Querying for theorems with branch {}", branch);
@@ -122,8 +122,8 @@ public class TheoremController {
name = name.toLowerCase();
if (name.contains("_") || name.contains("-")) {
name = name.replace("-", "\\s");
name = name.replace("-", "\\s");
name = name.replace("-", " ");
name = name.replace("-", " ");
}
LOG.debug("Querying for theorems with name {}", name);
@@ -95,7 +95,7 @@ public class TheoremControllerTest {
when(theoremRepository.findByBranch(anyString())).thenReturn(listOfTheorems);
final ResponseEntity<List<Theorem>> responseEntity = theoremController.getAllTheoremsByBranch("test");
final ResponseEntity<List<Theorem>> responseEntity = theoremController.getAllTheoremsByBranch("test-branch");
assertNotNull(responseEntity);
assertEquals(HttpStatus.OK, responseEntity.getStatusCode());
@@ -119,7 +119,7 @@ public class TheoremControllerTest {
public void testGetAllTheoremsByBranch_noTheoremsFound() {
when(theoremRepository.findByBranch(anyString())).thenReturn(Collections.emptyList());
final ResponseEntity<List<Theorem>> responseEntity = theoremController.getAllTheoremsByBranch("test nonexistent branch");
final ResponseEntity<List<Theorem>> responseEntity = theoremController.getAllTheoremsByBranch("test_nonexistent_branch");
assertNotNull(responseEntity);
assertFalse(responseEntity.hasBody());