PAN-52 Fixed issue with the Theorems API
This commit is contained in:
+4
-4
@@ -53,8 +53,8 @@ public class TheoremController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (branch.contains("_") || branch.contains("-")) {
|
if (branch.contains("_") || branch.contains("-")) {
|
||||||
branch = branch.replace("_", "\\s");
|
branch = branch.replace("_", " ");
|
||||||
branch = branch.replace("-", "\\s");
|
branch = branch.replace("-", " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG.debug("Querying for theorems with branch {}", branch);
|
LOG.debug("Querying for theorems with branch {}", branch);
|
||||||
@@ -122,8 +122,8 @@ public class TheoremController {
|
|||||||
name = name.toLowerCase();
|
name = name.toLowerCase();
|
||||||
|
|
||||||
if (name.contains("_") || name.contains("-")) {
|
if (name.contains("_") || name.contains("-")) {
|
||||||
name = name.replace("-", "\\s");
|
name = name.replace("-", " ");
|
||||||
name = name.replace("-", "\\s");
|
name = name.replace("-", " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG.debug("Querying for theorems with name {}", name);
|
LOG.debug("Querying for theorems with name {}", name);
|
||||||
|
|||||||
+2
-2
@@ -95,7 +95,7 @@ public class TheoremControllerTest {
|
|||||||
|
|
||||||
when(theoremRepository.findByBranch(anyString())).thenReturn(listOfTheorems);
|
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);
|
assertNotNull(responseEntity);
|
||||||
assertEquals(HttpStatus.OK, responseEntity.getStatusCode());
|
assertEquals(HttpStatus.OK, responseEntity.getStatusCode());
|
||||||
@@ -119,7 +119,7 @@ public class TheoremControllerTest {
|
|||||||
public void testGetAllTheoremsByBranch_noTheoremsFound() {
|
public void testGetAllTheoremsByBranch_noTheoremsFound() {
|
||||||
when(theoremRepository.findByBranch(anyString())).thenReturn(Collections.emptyList());
|
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);
|
assertNotNull(responseEntity);
|
||||||
assertFalse(responseEntity.hasBody());
|
assertFalse(responseEntity.hasBody());
|
||||||
|
|||||||
Reference in New Issue
Block a user