generated from hmcts/spring-boot-template
-
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
Showing
4 changed files
with
55 additions
and
12 deletions.
There are no files selected for viewing
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
47 changes: 47 additions & 0 deletions
47
src/test/java/uk/gov/hmcts/opal/controllers/CreateFineAccountsControllerTest.java
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package uk.gov.hmcts.opal.controllers; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import uk.gov.hmcts.opal.dto.OpalS2SRequestWrapper; | ||
import uk.gov.hmcts.opal.dto.OpalS2SResponseWrapper; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
|
||
class CreateFineAccountsControllerTest { | ||
|
||
private CreateFineAccountsController createFineAccountsController = new CreateFineAccountsController(); | ||
|
||
@Test | ||
void testSearchDebtorProfile_Success() { | ||
// Arrange | ||
OpalS2SRequestWrapper request = new OpalS2SRequestWrapper(); | ||
OpalS2SResponseWrapper response = OpalS2SResponseWrapper.builder() | ||
.opalResponsePayload(""" | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<CreateFineAccountsResponse | ||
xmlns="http://www.justice.gov.uk/magistrates/atcm/CreateFineAccountsResponse" | ||
xmlns:lg="http://www.justice.gov.uk/magistrates/atcm/CreatedFineAccount"> | ||
<lg:CreatedFineAccount> | ||
<CPPID xmlns="">12345</CPPID> | ||
<CPPUUID xmlns="">12345</CPPUUID> | ||
</lg:CreatedFineAccount> | ||
<NumberOfFineAccounts xmlns="">1</NumberOfFineAccounts> | ||
<ErrorCode xmlns=""></ErrorCode> | ||
<ErrorMessage xmlns=""></ErrorMessage> | ||
</CreateFineAccountsResponse> | ||
""") | ||
.build(); | ||
|
||
ResponseEntity<OpalS2SResponseWrapper> responseEntity = new ResponseEntity<>(response, HttpStatus.OK); | ||
|
||
// Act | ||
ResponseEntity<OpalS2SResponseWrapper> actualResponse = createFineAccountsController | ||
.createFineAccounts(request); | ||
|
||
// Assert | ||
assertEquals(HttpStatus.OK, actualResponse.getStatusCode()); | ||
assertEquals(response, actualResponse.getBody()); | ||
} | ||
} |
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