Improved mapping for retrieval of legislative terms

This commit is contained in:
Jim Martens 2020-07-11 22:12:16 +02:00
parent 3f2e2aaef3
commit 7e62fb8c9c
2 changed files with 3 additions and 3 deletions

View File

@ -156,7 +156,7 @@ public class OParlController {
});
}
@GetMapping("/term/{id}")
@GetMapping("/legislativeTerm/{id}")
@Operation(summary = "information about legislative term", description = "returns information about the requested legislative term", responses = {
@ApiResponse(description = "Successful Operation", responseCode = "200",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = LegislativeTerm.class))),
@ -167,7 +167,7 @@ public class OParlController {
@PathVariable
@Parameter(description = "legislative term ID", example = "21")
String id) {
log.info("method invoked /v1.1/term/{}", id);
log.info("method invoked /v1.1/legislativeTerm/{}", id);
return service.getLegislativeTerm(id).orElseThrow(() -> {
throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Legislaturperiode mit angefragter ID existiert nicht");
});

View File

@ -194,7 +194,7 @@ class OParlControllerTest {
BDDMockito.given(service.getLegislativeTerm("21"))
.willReturn(Optional.of(testTerm));
mvc.perform(MockMvcRequestBuilders.get("/v1.1/term/21")
mvc.perform(MockMvcRequestBuilders.get("/v1.1/legislativeTerm/21")
.contentType(MediaType.APPLICATION_JSON))
.andExpect(MockMvcResultMatchers.status().isOk())
.andExpect(MockMvcResultMatchers.jsonPath("$", Matchers.aMapWithSize(9)))