Skip to content

Commit

Permalink
[VAS-506] fixed unit tests after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
giomella committed Mar 5, 2024
1 parent 5390aa5 commit 25d1810
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import it.pagopa.selfcare.pagopa.model.ProblemJson;
import it.pagopa.selfcare.pagopa.service.BrokersService;
import it.pagopa.selfcare.pagopa.util.OpenApiTableMetadata;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
Expand All @@ -32,11 +33,11 @@ public class BrokerController {

private final BrokersService brokersService;

@Autowired
public BrokerController(BrokersService brokersService) {
this.brokersService = brokersService;
}


/**
* Retreive a paged list of broker related ibans
* @param limit number of elements per page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
@AutoConfigureMockMvc
class BrokerControllerTest {

private static final String PAGE = "page";

@Autowired
private MockMvc mvc;

Expand All @@ -43,7 +45,9 @@ void setUp() {
@Test
void exportCreditorInstitutionsWithValidCodeShouldReturn20XAndData() throws Exception {
String url = "/brokers/11111/creditor_institutions";
mvc.perform(get(url).contentType(MediaType.APPLICATION_JSON))
mvc.perform(get(url)
.param(PAGE, "0")
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().contentType("application/json"));
verify(brokersService).getBrokerInstitutions("11111",10,0);
Expand All @@ -52,7 +56,9 @@ void exportCreditorInstitutionsWithValidCodeShouldReturn20XAndData() throws Exce
@Test
void exportCreditorInstitutionsWithMissingCodeShouldReturnNotFound() throws Exception {
String url = "/brokers/00000/creditor_institutions";
mvc.perform(get(url).contentType(MediaType.APPLICATION_JSON))
mvc.perform(get(url)
.param(PAGE, "0")
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isNotFound())
.andExpect(content().contentType("application/json"));
verify(brokersService).getBrokerInstitutions("00000",10,0);
Expand All @@ -61,7 +67,9 @@ void exportCreditorInstitutionsWithMissingCodeShouldReturnNotFound() throws Exce
@Test
void getBrokerIbansShouldReturn20XAndData() throws Exception {
String url = "/brokers/ibans";
mvc.perform(get(url).contentType(MediaType.APPLICATION_JSON))
mvc.perform(get(url)
.param(PAGE, "0")
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().contentType("application/json"));
verify(brokersService).getBrokersIbans(10,0);
Expand Down

0 comments on commit 25d1810

Please sign in to comment.