Skip to content

Commit

Permalink
renamed method into getCIsIbans
Browse files Browse the repository at this point in the history
  • Loading branch information
jacopocarlini committed Jul 23, 2024
1 parent 7d08b4d commit d1c955e
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class LoggingAspect {
public static final String OPERATION_ID = "operationId";
public static final String ARGS = "args";


@Autowired
HttpServletRequest httRequest;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public CIIbansResponse getCIsIbans(
@Parameter(description = "Number of elements on one page. Default = 10")
@RequestParam(required = false, defaultValue = "10") @Min(value = 0) @Max(value = 100) Integer limit,
@Parameter(description = "Page number. Page value starts from 0") @RequestParam @Min(value = 0) Integer page) {
return externalService.getBrokersIbans(limit, page);
return externalService.getCIsIbans(limit, page);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public interface ExternalService {
* @param page page to be used
* @return paged list od broker related ibans
*/
CIIbansResponse getBrokersIbans(Integer limit, Integer page);
CIIbansResponse getCIsIbans(Integer limit, Integer page);

/**
* Retrieve a paged list of ibans, using a specific broker code
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public BrokerInstitutionsResponse getBrokerInstitutions(String brokerCode, Integ
}

@Override
public CIIbansResponse getBrokersIbans(Integer limit, Integer page) {
public CIIbansResponse getCIsIbans(Integer limit, Integer page) {
Pageable pageable = PageRequest.of(page, limit);
Page<CreditorInstitutionIbansEntity> creditorInstitutionIbansEntities = creditorInstitutionIbansRepository.findAll(pageable);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class ExternalControllerTest {
void setUp() {
when(externalService.getBrokerInstitutions("11111",10, 0))
.thenReturn(BrokerInstitutionsResponse.builder().build());
when(externalService.getBrokersIbans(10, 0))
when(externalService.getCIsIbans(10, 0))
.thenReturn(CIIbansResponse.builder().build());
when(externalService.getBrokerIbans("11111",10, 0))
.thenReturn(CIIbansResponse.builder().build());
Expand Down Expand Up @@ -76,7 +76,7 @@ void getBrokerIbansShouldReturn20XAndData() throws Exception {
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().contentType("application/json"));
verify(externalService).getBrokersIbans(10,0);
verify(externalService).getCIsIbans(10,0);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void requestWithValidDataShouldReturnIbanList() {
Page<CreditorInstitutionIbansEntity> page = new PageImpl<>(List.of(iban), Pageable.unpaged(), ibanList.size());
when(creditorInstitutionIbansRepository.findAll(Pageable.ofSize(10))).thenReturn(page);
CIIbansResponse brokerInstitutionsResponse = Assertions.assertDoesNotThrow(
() -> institutionsService.getBrokersIbans(10, 0));
() -> institutionsService.getCIsIbans(10, 0));
Assert.notNull(brokerInstitutionsResponse);
Assert.notNull(brokerInstitutionsResponse.getPageInfo());
Assert.notNull(brokerInstitutionsResponse.getIbans());
Expand All @@ -92,7 +92,7 @@ void requestWithValidDataShouldReturnIbanList() {
@Test
void requestWithMissingIbansShouldReturnEmptyList() {
when(creditorInstitutionIbansRepository.findAll(Pageable.ofSize(10))).thenReturn(Page.empty());
CIIbansResponse brokerInstitutionsResponse = Assertions.assertDoesNotThrow(() -> institutionsService.getBrokersIbans(10, 0));
CIIbansResponse brokerInstitutionsResponse = Assertions.assertDoesNotThrow(() -> institutionsService.getCIsIbans(10, 0));
Assert.notNull(brokerInstitutionsResponse);
Assert.notNull(brokerInstitutionsResponse.getPageInfo());
Assert.notNull(brokerInstitutionsResponse.getIbans());
Expand Down

0 comments on commit d1c955e

Please sign in to comment.