-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d0d1c24
commit 6d7ae14
Showing
22 changed files
with
2,141 additions
and
180 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,9 +34,11 @@ | |
import uk.gov.laa.ccms.caab.api.entity.AuditTrail; | ||
import uk.gov.laa.ccms.caab.api.service.ApplicationService; | ||
import uk.gov.laa.ccms.caab.model.ApplicationDetail; | ||
import uk.gov.laa.ccms.caab.model.LinkedCase; | ||
import uk.gov.laa.ccms.caab.model.ApplicationDetails; | ||
import uk.gov.laa.ccms.caab.model.BaseApplication; | ||
import uk.gov.laa.ccms.caab.model.LinkedCase; | ||
import uk.gov.laa.ccms.caab.model.Proceeding; | ||
import uk.gov.laa.ccms.caab.model.ScopeLimitation; | ||
import uk.gov.laa.ccms.data.api.AbstractIntegrationTest; | ||
|
||
@SpringBootTest(classes = CaabApiApplication.class) | ||
|
@@ -154,7 +156,8 @@ public void testCreateApplication(String fileInput, String auditTrailMethod, Lis | |
|
||
String auditUser = "[email protected]"; | ||
// Call the createApplication method directly | ||
ResponseEntity<Void> responseEntity = applicationController.createApplication(auditUser, applicationDetail); | ||
ResponseEntity<Void> responseEntity = | ||
applicationController.createApplication(auditUser, applicationDetail); | ||
|
||
assertEquals(HttpStatus.CREATED, responseEntity.getStatusCode()); | ||
URI locationUri = responseEntity.getHeaders().getLocation(); | ||
|
@@ -167,15 +170,34 @@ public void testCreateApplication(String fileInput, String auditTrailMethod, Lis | |
assertAuditTrail(savedApplicationDetails, auditTrailMethod, auditUser); | ||
setAuditPropertiesToNull(savedApplicationDetails, auditTrailsToNull); | ||
|
||
//null out the id's as they are generated by the database | ||
//theses will always be different | ||
if (savedApplicationDetails.getLinkedCases() != null){ | ||
for (LinkedCase linkedCase : savedApplicationDetails.getLinkedCases()){ | ||
nullIds(applicationDetail); | ||
|
||
assertEquals(applicationDetail, savedApplicationDetails); | ||
} | ||
|
||
private void nullIds(ApplicationDetail applicationDetail) { | ||
if (applicationDetail.getLinkedCases() != null) { | ||
for (LinkedCase linkedCase : applicationDetail.getLinkedCases()) { | ||
linkedCase.setId(null); | ||
} | ||
} | ||
|
||
assertEquals(applicationDetail, savedApplicationDetails); | ||
if (applicationDetail.getProceedings() != null) { | ||
for (Proceeding proceeding : applicationDetail.getProceedings()) { | ||
proceeding.setId(null); | ||
if (proceeding.getScopeLimitations() != null) { | ||
for (ScopeLimitation scopeLimitation : proceeding.getScopeLimitations()) { | ||
scopeLimitation.setId(null); | ||
} | ||
} | ||
} | ||
} | ||
|
||
if (applicationDetail.getPriorAuthorities() != null) { | ||
for (uk.gov.laa.ccms.caab.model.PriorAuthority priorAuthority : applicationDetail.getPriorAuthorities()) { | ||
priorAuthority.setId(null); | ||
} | ||
} | ||
} | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.