Browse Source

Improved mapping for retrieval of legislative terms

master
Jim Martens 10 months ago
parent
commit
7e62fb8c9c
  1. 4
      oparl-server/src/main/java/de/twomartens/oparlservice/control/OParlController.java
  2. 2
      oparl-server/src/test/java/de/twomartens/oparlservice/control/OParlControllerTest.java

4
oparl-server/src/main/java/de/twomartens/oparlservice/control/OParlController.java

@ -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");
});

2
oparl-server/src/test/java/de/twomartens/oparlservice/control/OParlControllerTest.java

@ -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…
Cancel
Save