Skip to content

Commit

Permalink
feat(impl):[#259] fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
ds-ext-kmassalski committed Dec 15, 2023
1 parent 9c49bca commit c71698b
Showing 1 changed file with 5 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@ void shouldReturn500WhenGetSemanticModelsFails() throws Exception {

when(semanticHubService.getAllAspectModels()).thenThrow(InternalServerError.class);

this.mockMvc.perform(get("/irs/aspectmodels").contentType(MediaType.APPLICATION_JSON)
.content(new ObjectMapper().writeValueAsString(
registerJobWithoutDepthAndAspect())))
this.mockMvc.perform(get("/irs/aspectmodels"))
.andExpect(status().is5xxServerError());
}

Expand All @@ -89,9 +87,7 @@ void shouldReturn400WhenProvidingBadInput() throws Exception {

when(semanticHubService.getAllAspectModels()).thenThrow(IllegalArgumentException.class);

this.mockMvc.perform(get("/irs/aspectmodels").contentType(MediaType.APPLICATION_JSON)
.content(new ObjectMapper().writeValueAsString(
registerJobWithoutDepthAndAspect())))
this.mockMvc.perform(get("/irs/aspectmodels"))
.andExpect(status().isBadRequest());
}

Expand All @@ -101,9 +97,7 @@ void shouldReturn400WhenCatchingIllegalStateException() throws Exception {

when(semanticHubService.getAllAspectModels()).thenThrow(IllegalStateException.class);

this.mockMvc.perform(get("/irs/aspectmodels").contentType(MediaType.APPLICATION_JSON)
.content(new ObjectMapper().writeValueAsString(
registerJobWithoutDepthAndAspect())))
this.mockMvc.perform(get("/irs/aspectmodels"))
.andExpect(status().isBadRequest());
}

Expand All @@ -113,9 +107,7 @@ void shouldReturn400WhenCatchingMethodArgumentTypeMismatchException() throws Exc

when(semanticHubService.getAllAspectModels()).thenThrow(MethodArgumentTypeMismatchException.class);

this.mockMvc.perform(get("/irs/aspectmodels").contentType(MediaType.APPLICATION_JSON)
.content(new ObjectMapper().writeValueAsString(
registerJobWithoutDepthAndAspect())))
this.mockMvc.perform(get("/irs/aspectmodels"))
.andExpect(status().isBadRequest());
}

Expand All @@ -125,9 +117,7 @@ void shouldReturn403WhenRightsAreMissing() throws Exception {

when(semanticHubService.getAllAspectModels()).thenThrow(AccessDeniedException.class);

this.mockMvc.perform(get("/irs/aspectmodels").contentType(MediaType.APPLICATION_JSON)
.content(new ObjectMapper().writeValueAsString(
registerJobWithoutDepthAndAspect())))
this.mockMvc.perform(get("/irs/aspectmodels"))
.andExpect(status().isForbidden());
}
}

0 comments on commit c71698b

Please sign in to comment.