Skip to content

Commit

Permalink
use v2 for quarter url and update tests accoridingly
Browse files Browse the repository at this point in the history
  • Loading branch information
kcinay055679 committed Oct 21, 2024
1 parent 7633a86 commit 07e6aea
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import java.util.List;

@RestController
@RequestMapping("api/v1/quarters")
@RequestMapping("api/v2/quarters")
public class QuarterController {

private final QuarterBusinessService quarterBusinessService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class QuarterControllerIT {
void shouldGetAllQuarters() throws Exception {
BDDMockito.given(quarterBusinessService.getQuarters()).willReturn(quaterList);

mvc.perform(get("/api/v1/quarters").contentType(MediaType.APPLICATION_JSON))
mvc.perform(get("/api/v2/quarters").contentType(MediaType.APPLICATION_JSON))
.andExpect(MockMvcResultMatchers.status().isOk()).andExpect(jsonPath("$", Matchers.hasSize(3)))
.andExpect(jsonPath("$[0].id", Is.is(1))).andExpect(jsonPath("$[0].label", Is.is("GJ 22/23-Q2")))
.andExpect(jsonPath("$[0].startDate", Is.is(LocalDate.of(2022, 9, 1).toString())))
Expand All @@ -65,13 +65,13 @@ void shouldGetAllQuarters() throws Exception {
void shouldGetAllTeamsIfNoTeamsExists() throws Exception {
BDDMockito.given(quarterBusinessService.getQuarters()).willReturn(Collections.emptyList());

mvc.perform(get("/api/v1/quarters").contentType(MediaType.APPLICATION_JSON))
mvc.perform(get("/api/v2/quarters").contentType(MediaType.APPLICATION_JSON))
.andExpect(MockMvcResultMatchers.status().isOk()).andExpect(jsonPath("$", Matchers.hasSize(0)));
}

@Test
void shouldCallCurrentQuarterAfterRequest() throws Exception {
mvc.perform(get("/api/v1/quarters/current").contentType(MediaType.APPLICATION_JSON));
mvc.perform(get("/api/v2/quarters/current").contentType(MediaType.APPLICATION_JSON));

BDDMockito.verify(quarterBusinessService, Mockito.times(1)).getCurrentQuarter();
}
Expand Down

0 comments on commit 07e6aea

Please sign in to comment.