Skip to content

Commit

Permalink
Merge branch 'refs/heads/develop' into fixBaseUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
antocalo committed Dec 12, 2024
2 parents 742ce83 + fae60c0 commit 4da1cc8
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 13 deletions.
1 change: 1 addition & 0 deletions openapi/p4pa-pdnd.openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ paths:
get:
summary: Retrieve citizen data
description: Returns detailed information about a citizen based on their fiscal code.
operationId: getCitizenDataByFiscalCode
parameters:
- name: fiscalCode
in: query
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public PdndServiceController(PdndService pdndService) {
}

@Override
public ResponseEntity<Citizen> anprServiceE002CitizenGet(String fiscalCode) {
public ResponseEntity<Citizen> getCitizenDataByFiscalCode(String fiscalCode) {
Citizen response = pdndService.getCitizenData(fiscalCode);
return ResponseEntity.ok(response);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void setUp() {
}

@Test
void getUserData() {
void givenValidRequestWhenGetUserDataThenReturnValidResponse() {
RichiestaE002 request = RichiestaE002.builder()
.idOperazioneClient("13f32508-7bcb-38d0-8510-d68bf240aa59-1733496758205")
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class AnprC003ServiceTest {
private AnprC003Service anprC003Service;

@Test
void getUserData() {
void givenValidIdAnprAndFiscalCodeWhenGetUserDataThenReturnUserDataSuccessfully() {
String fiscalCode = "DNTCRL65S67M126K";
String idAnpr = "d20fcd8e-f228-323c-8924-6405b44879bf";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void setUp() {
}

@Test
void testGetIdAnprFromFc() {
void givenValidRequestWhenGetIdAnprFromFcThenReturnValidResponse() {
RichiestaE002 request = RichiestaE002.builder()
.idOperazioneClient("13f32508-7bcb-38d0-8510-d68bf240aa59-1733496758205")
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class AnprC030ServiceTest {
private AnprC030Service anprC030Service;

@Test
void testGetIdAnprFromFc() {
void givenValidFiscalCodeWhenGetIdAnprFromFcThenReturnValidResponse() {
String fiscalCode = "DNTCRL65S67M126K";

TipoIdentificativi idTypes = TipoIdentificativi.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class PdndServiceControllerTest {
private PdndService pdndService;

@Test
void testAnprServiceE002CitizenGet_Success() throws Exception {
void givenValidFiscalCodeWhenGetCitizenDataThenReturnCitizenDetails() throws Exception {
String fiscalCode = "DNTCRL65S67M126K";
Citizen citizen = Citizen.builder()
.firstName("Julieta")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class PdndServiceImplTest {
private PdndServiceImpl pdndService;

@Test
void testGetCitizenData_Success() {
void givenValidFiscalCodeAndIdAnprWhenGetCitizenDataThenReturnCitizenDetails() {
String fiscalCode = "DNTCRL65S67M126K";
String idAnpr = "d20fcd8e-f228-323c-8924-6405b44879bf";

Expand Down Expand Up @@ -73,7 +73,7 @@ void testGetCitizenData_Success() {
}

@Test
void testGetCitizenData_InvalidListaSoggetti() {
void givenValidFiscalCodeAndInvalidSubjectListWhenGetCitizenDataThenThrowIllegalArgumentException() {
String fiscalCode = "DNTCRL65S67M126K";
String idAnpr = "d20fcd8e-f228-323c-8924-6405b44879bf";

Expand All @@ -98,7 +98,7 @@ void testGetCitizenData_InvalidListaSoggetti() {
}

@Test
void testGetCitizenData_InvalidC003Response() {
void givenValidFiscalCodeAndInvalidC003ResponseWhenGetCitizenDataThenThrowIllegalArgumentException() {
String fiscalCode = "DNTCRL65S67M126K";
String idAnpr = "d20fcd8e-f228-323c-8924-6405b44879bf";

Expand All @@ -120,7 +120,7 @@ void testGetCitizenData_InvalidC003Response() {
}

@Test
void testGetCitizenData_InvalidSubDataType() {
void givenValidFiscalCodeAndInvalidSubDataTypeWhenGetCitizenDataThenThrowIllegalArgumentException() {
String fiscalCode = "DNTCRL65S67M126K";
String idAnpr = "d20fcd8e-f228-323c-8924-6405b44879bf";

Expand All @@ -146,7 +146,7 @@ void testGetCitizenData_InvalidSubDataType() {
}

@Test
void testGetCitizenData_EmptySubDataType() {
void givenValidFiscalCodeAndEmptySubDataTypeWhenGetCitizenDataThenThrowIllegalArgumentException() {
String fiscalCode = "DNTCRL65S67M126K";
String idAnpr = "d20fcd8e-f228-323c-8924-6405b44879bf";

Expand All @@ -172,11 +172,11 @@ void testGetCitizenData_EmptySubDataType() {
}

@Test
void testGetCitizenData_InvalidResponse_ThrowsException() {
void givenServiceUnavailableWhenGetCitizenDataThenThrowRuntimeException() {
String fiscalCode = "DNTCRL65S67M126K";

Mockito.when(anprC030Service.getIdAnprFromFc(fiscalCode)).thenThrow(new RuntimeException("Service unavailable"));

assertThrows(RuntimeException.class, () -> pdndService.getCitizenData(fiscalCode));
}
}
}

0 comments on commit 4da1cc8

Please sign in to comment.