generated from 2martens/template-service
Improved mapping for retrieval of legislative terms
This commit is contained in:
parent
3f2e2aaef3
commit
7e62fb8c9c
|
@ -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");
|
||||
});
|
||||
|
|
|
@ -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)))
|
||||
|
|
Loading…
Reference in New Issue