Skip to content

Commit

Permalink
Align REST endpoints for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
RustyHMCTS committed Feb 14, 2024
1 parent cea34e7 commit 4c01f35
Show file tree
Hide file tree
Showing 18 changed files with 18 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


@RestController
@RequestMapping("/api/accountTransfers")
@RequestMapping("/api/account-transfer")
@Slf4j(topic = "AccountTransferController")
@Tag(name = "AccountTransfer Controller")
public class AccountTransferController {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


@RestController
@RequestMapping("/api/businessUnits")
@RequestMapping("/api/business-unit")
@Slf4j(topic = "BusinessUnitController")
@Tag(name = "BusinessUnit Controller")
public class BusinessUnitController {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


@RestController
@RequestMapping("/api/committalWarrantProgress")
@RequestMapping("/api/committal-warrant-progress")
@Slf4j(topic = "CommittalWarrantProgressController")
@Tag(name = "CommittalWarrantProgress Controller")
public class CommittalWarrantProgressController {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


@RestController
@RequestMapping("/api/courts")
@RequestMapping("/api/court")
@Slf4j(topic = "CourtController")
@Tag(name = "Court Controller")
public class CourtController {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


@RestController
@RequestMapping("/api/debtorDetails")
@RequestMapping("/api/debtor-detail")
@Slf4j(topic = "DebtorDetailController")
@Tag(name = "DebtorDetail Controller")
public class DebtorDetailController {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,22 +82,9 @@ public ResponseEntity<DefendantAccountEntity> putDefendantAccount(
return ResponseEntity.ok(response);
}

@GetMapping(value = "/{businessUnit}")
@Operation(summary = "Returns all defendant accounts within a business unit")
public ResponseEntity<List<DefendantAccountEntity>> getDefendantAccountsByBusinessUnit(
@PathVariable short businessUnit) {

log.info(":GET:getDefendantAccountsByBusinessUnit: busUnit: {}", businessUnit);
List<DefendantAccountEntity> response = defendantAccountService
.getDefendantAccountsByBusinessUnit(businessUnit);

return buildResponse(response);
}

@GetMapping(value = "/details")
@GetMapping(value = "/{defendantAccountId}")
@Operation(summary = "Get defendant account details by providing the defendant account summary")
public ResponseEntity<AccountDetailsDto> getAccountDetailsByAccountSummary(
@RequestParam(name = "defendantAccountId") Long defendantAccountId) {
public ResponseEntity<AccountDetailsDto> getAccountDetailsByAccountSummary(@PathVariable Long defendantAccountId) {

AccountDetailsDto response = defendantAccountService.getAccountDetailsByDefendantAccountId(defendantAccountId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


@RestController
@RequestMapping("/api/documents")
@RequestMapping("/api/document")
@Slf4j(topic = "DocumentController")
@Tag(name = "Document Controller")
public class DocumentController {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


@RestController
@RequestMapping("/api/documentInstances")
@RequestMapping("/api/document-instance")
@Slf4j(topic = "DocumentInstanceController")
@Tag(name = "DocumentInstance Controller")
public class DocumentInstanceController {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


@RestController
@RequestMapping("/api/enforcements")
@RequestMapping("/api/enforcement")
@Slf4j(topic = "EnforcementController")
@Tag(name = "Enforcement Controller")
public class EnforcementController {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


@RestController
@RequestMapping("/api/enforcers")
@RequestMapping("/api/enforcer")
@Slf4j(topic = "EnforcerController")
@Tag(name = "Enforcer Controller")
public class EnforcerController {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


@RestController
@RequestMapping("/api/localJusticeAreas")
@RequestMapping("/api/local-justice-area")
@Slf4j(topic = "LocalJusticeAreaController")
@Tag(name = "LocalJusticeArea Controller")
public class LocalJusticeAreaController {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


@RestController
@RequestMapping("/api/misDebtors")
@RequestMapping("/api/mis-debtor")
@Slf4j(topic = "MisDebtorController")
@Tag(name = "MisDebtor Controller")
public class MisDebtorController {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@


@RestController
@RequestMapping("/api/notes")
@RequestMapping("/api/note")
@Slf4j(topic = "NoteController")
@Tag(name = "Notes Controller")
public class NoteController {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


@RestController
@RequestMapping("/api/paymentIns")
@RequestMapping("/api/payment-in")
@Slf4j(topic = "PaymentInController")
@Tag(name = "PaymentIn Controller")
public class PaymentInController {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


@RestController
@RequestMapping("/api/paymentTerms")
@RequestMapping("/api/payment-terms")
@Slf4j(topic = "PaymentTermsController")
@Tag(name = "PaymentTerms Controller")
public class PaymentTermsController {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


@RestController
@RequestMapping("/api/prisons")
@RequestMapping("/api/prison")
@Slf4j(topic = "PrisonController")
@Tag(name = "Prison Controller")
public class PrisonController {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


@RestController
@RequestMapping("/api/tills")
@RequestMapping("/api/till")
@Slf4j(topic = "TillController")
@Tag(name = "Till Controller")
public class TillController {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,25 +92,6 @@ public void testPutDefendantAccount_Success() {
DefendantAccountEntity.class));
}

@Test
public void testGetDefendantAccounts_Success() {
// Arrange
List<DefendantAccountEntity> mockResponse = List.of(new DefendantAccountEntity());

when(defendantAccountService.getDefendantAccountsByBusinessUnit(any(Short.class))).thenReturn(mockResponse);

// Act
ResponseEntity<List<DefendantAccountEntity>> responseEntity = defendantAccountController
.getDefendantAccountsByBusinessUnit(any(Short.class));

// Assert
assertEquals(HttpStatus.OK, responseEntity.getStatusCode());
assertEquals(mockResponse, responseEntity.getBody());
verify(defendantAccountService, times(1)).getDefendantAccountsByBusinessUnit(any(
Short.class));

}

@Test
public void testGetDefendantAccountDetails_Success() {
// Arrange
Expand Down

0 comments on commit 4c01f35

Please sign in to comment.