Added check for fiscalcode
This commit is contained in:
parent
9648bbbace
commit
62f469f963
|
@ -52,7 +52,6 @@ public class EPASPersonsResourceIT {
|
||||||
|
|
||||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||||
|
|
||||||
|
|
||||||
private static final String PERSON_DEFAULT_ID = "11694";
|
private static final String PERSON_DEFAULT_ID = "11694";
|
||||||
private static final String PERSON_DEFAULT_NAME = "nometest1";
|
private static final String PERSON_DEFAULT_NAME = "nometest1";
|
||||||
private static final String PERSON_DEFAULT_SURNAME = "cognometest1";
|
private static final String PERSON_DEFAULT_SURNAME = "cognometest1";
|
||||||
|
@ -113,14 +112,15 @@ public class EPASPersonsResourceIT {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getPersonById() throws Exception {
|
public void getPersonById() throws Exception {
|
||||||
restEPASPersonsMockMvc.perform(get("/api/epas/persons/"+PERSON_DEFAULT_ID)).andExpect(status().isOk());
|
restEPASPersonsMockMvc.perform(get("/api/epas/persons/" + PERSON_DEFAULT_ID)).andExpect(status().isOk());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getPersonByFiscalCode() throws Exception {
|
public void getPersonByFiscalCode() throws Exception {
|
||||||
restEPASPersonsMockMvc.perform(get("/api/epas/persons/show?fiscalCode="+PERSON_DEFAULT_FISCAL_CODE)).andExpect(status().isOk());
|
restEPASPersonsMockMvc.perform(get("/api/epas/persons/show?fiscalCode=" + PERSON_DEFAULT_FISCAL_CODE))
|
||||||
|
.andExpect(status().isOk());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getPersonList() throws Exception {
|
public void getPersonList() throws Exception {
|
||||||
restEPASPersonsMockMvc.perform(get("/api/epas/persons?officeId=" + OfficeConstants.ISTI_OFFICE_ID))
|
restEPASPersonsMockMvc.perform(get("/api/epas/persons?officeId=" + OfficeConstants.ISTI_OFFICE_ID))
|
||||||
|
@ -136,6 +136,43 @@ public class EPASPersonsResourceIT {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void checkFiscalCode() {
|
||||||
|
List<EPASPersons> epasPersons = null;
|
||||||
|
try {
|
||||||
|
MvcResult result = restEPASPersonsMockMvc
|
||||||
|
.perform(get("/api/epas/persons?officeId=" + OfficeConstants.ISTI_OFFICE_ID))
|
||||||
|
.andExpect(status().isOk()).andReturn();
|
||||||
|
|
||||||
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
|
epasPersons = mapper.readValue(result.getResponse().getContentAsString(),
|
||||||
|
new TypeReference<List<EPASPersons>>() {
|
||||||
|
});
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getLocalizedMessage(), e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (epasPersons != null && !epasPersons.isEmpty()) {
|
||||||
|
log.info("EPAS Persons loaded: {}", epasPersons.size());
|
||||||
|
} else {
|
||||||
|
log.error("EPAS Persons not loaded");
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean e=false;
|
||||||
|
for(EPASPersons p: epasPersons) {
|
||||||
|
if(p.getFiscalCode()==null||p.getFiscalCode().isEmpty()) {
|
||||||
|
log.error("Invalid Fiscal Code: ePASPerson[{}, {}, {}]", p.getSurname(),p.getName(),p.getFiscalCode());
|
||||||
|
e=true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!e){
|
||||||
|
log.info("All persons have a Fiscal Code");
|
||||||
|
}
|
||||||
|
log.info("Check Fiscal Code End.");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void istiUpdatedPerson() {
|
public void istiUpdatedPerson() {
|
||||||
String userDirectory = System.getProperty("user.dir");
|
String userDirectory = System.getProperty("user.dir");
|
||||||
|
@ -152,7 +189,8 @@ public class EPASPersonsResourceIT {
|
||||||
|
|
||||||
List<EPASPersons> epasPersons = null;
|
List<EPASPersons> epasPersons = null;
|
||||||
try {
|
try {
|
||||||
MvcResult result = restEPASPersonsMockMvc.perform(get("/api/epas/persons?officeId=" + OfficeConstants.ISTI_OFFICE_ID))
|
MvcResult result = restEPASPersonsMockMvc
|
||||||
|
.perform(get("/api/epas/persons?officeId=" + OfficeConstants.ISTI_OFFICE_ID))
|
||||||
.andExpect(status().isOk()).andReturn();
|
.andExpect(status().isOk()).andReturn();
|
||||||
|
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
|
|
Loading…
Reference in New Issue