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 = {
|
@Operation(summary = "information about legislative term", description = "returns information about the requested legislative term", responses = {
|
||||||
@ApiResponse(description = "Successful Operation", responseCode = "200",
|
@ApiResponse(description = "Successful Operation", responseCode = "200",
|
||||||
content = @Content(mediaType = "application/json", schema = @Schema(implementation = LegislativeTerm.class))),
|
content = @Content(mediaType = "application/json", schema = @Schema(implementation = LegislativeTerm.class))),
|
||||||
|
@ -167,7 +167,7 @@ public class OParlController {
|
||||||
@PathVariable
|
@PathVariable
|
||||||
@Parameter(description = "legislative term ID", example = "21")
|
@Parameter(description = "legislative term ID", example = "21")
|
||||||
String id) {
|
String id) {
|
||||||
log.info("method invoked /v1.1/term/{}", id);
|
log.info("method invoked /v1.1/legislativeTerm/{}", id);
|
||||||
return service.getLegislativeTerm(id).orElseThrow(() -> {
|
return service.getLegislativeTerm(id).orElseThrow(() -> {
|
||||||
throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Legislaturperiode mit angefragter ID existiert nicht");
|
throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Legislaturperiode mit angefragter ID existiert nicht");
|
||||||
});
|
});
|
||||||
|
|
|
@ -194,7 +194,7 @@ class OParlControllerTest {
|
||||||
BDDMockito.given(service.getLegislativeTerm("21"))
|
BDDMockito.given(service.getLegislativeTerm("21"))
|
||||||
.willReturn(Optional.of(testTerm));
|
.willReturn(Optional.of(testTerm));
|
||||||
|
|
||||||
mvc.perform(MockMvcRequestBuilders.get("/v1.1/term/21")
|
mvc.perform(MockMvcRequestBuilders.get("/v1.1/legislativeTerm/21")
|
||||||
.contentType(MediaType.APPLICATION_JSON))
|
.contentType(MediaType.APPLICATION_JSON))
|
||||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||||
.andExpect(MockMvcResultMatchers.jsonPath("$", Matchers.aMapWithSize(9)))
|
.andExpect(MockMvcResultMatchers.jsonPath("$", Matchers.aMapWithSize(9)))
|
||||||
|
|
Loading…
Reference in New Issue