Skip to content

Commit

Permalink
MODDCB-124 Fix indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
OleksandrVidinieiev committed Nov 4, 2024
1 parent 9f41d8f commit 0cafe09
Showing 1 changed file with 26 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,20 @@ void createLendingEcsRequestTest() throws Exception {
removeExistedTransactionFromDbIfSoExists();

this.mockMvc.perform(
post("/ecs-request-transactions/" + CIRCULATION_REQUEST_ID)
.content(asJsonString(createLendingEcsRequestTransactionByRole()))
.headers(defaultHeaders())
.contentType(MediaType.APPLICATION_JSON)
.accept(MediaType.APPLICATION_JSON))
post("/ecs-request-transactions/" + CIRCULATION_REQUEST_ID)
.content(asJsonString(createLendingEcsRequestTransactionByRole()))
.headers(defaultHeaders())
.contentType(MediaType.APPLICATION_JSON)
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isCreated());

//Trying to create another transaction with same transaction id
this.mockMvc.perform(
post("/ecs-request-transactions/" + CIRCULATION_REQUEST_ID)
.content(asJsonString(createLendingEcsRequestTransactionByRole()))
.headers(defaultHeaders())
.contentType(MediaType.APPLICATION_JSON)
.accept(MediaType.APPLICATION_JSON))
post("/ecs-request-transactions/" + CIRCULATION_REQUEST_ID)
.content(asJsonString(createLendingEcsRequestTransactionByRole()))
.headers(defaultHeaders())
.contentType(MediaType.APPLICATION_JSON)
.accept(MediaType.APPLICATION_JSON))
.andExpectAll(status().is4xxClientError(),
jsonPath("$.errors[0].code", is("DUPLICATE_ERROR")));

Expand All @@ -62,8 +62,11 @@ void createLendingEcsRequestTest() throws Exception {
.findLatestTransactionAuditEntityByDcbTransactionId(CIRCULATION_REQUEST_ID)
.orElse(null);
Assertions.assertNotNull(auditExisting);
Assertions.assertNotEquals(TRANSACTION_AUDIT_DUPLICATE_ERROR_ACTION, auditExisting.getAction());
Assertions.assertNotEquals(DUPLICATE_ERROR_TRANSACTION_ID, auditExisting.getTransactionId()); }
Assertions.assertNotEquals(TRANSACTION_AUDIT_DUPLICATE_ERROR_ACTION,
auditExisting.getAction());
Assertions.assertNotEquals(DUPLICATE_ERROR_TRANSACTION_ID,
auditExisting.getTransactionId());
}
);
}

Expand All @@ -72,11 +75,11 @@ void createBorrowingEcsRequestTest() throws Exception {
removeExistedTransactionFromDbIfSoExists();

this.mockMvc.perform(
post("/ecs-request-transactions/" + CIRCULATION_REQUEST_ID)
.content(asJsonString(createBorrowingEcsRequestTransactionByRole()))
.headers(defaultHeaders())
.contentType(MediaType.APPLICATION_JSON)
.accept(MediaType.APPLICATION_JSON))
post("/ecs-request-transactions/" + CIRCULATION_REQUEST_ID)
.content(asJsonString(createBorrowingEcsRequestTransactionByRole()))
.headers(defaultHeaders())
.contentType(MediaType.APPLICATION_JSON)
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isCreated());
}

Expand All @@ -85,17 +88,17 @@ void checkErrorStatusForInvalidRequest() throws Exception {
DcbTransaction dcbTransaction = createLendingEcsRequestTransactionByRole();
dcbTransaction.setRequestId(UUID.randomUUID().toString());
this.mockMvc.perform(
post("/ecs-request-transactions/" + CIRCULATION_REQUEST_ID)
.content(asJsonString(dcbTransaction))
.headers(defaultHeaders())
.contentType(MediaType.APPLICATION_JSON)
.accept(MediaType.APPLICATION_JSON))
post("/ecs-request-transactions/" + CIRCULATION_REQUEST_ID)
.content(asJsonString(dcbTransaction))
.headers(defaultHeaders())
.contentType(MediaType.APPLICATION_JSON)
.accept(MediaType.APPLICATION_JSON))
.andExpectAll(status().is4xxClientError());
}

private void removeExistedTransactionFromDbIfSoExists() {
systemUserScopedExecutionService.executeAsyncSystemUserScoped(TENANT, () -> {
if (transactionRepository.existsById(CIRCULATION_REQUEST_ID)){
if (transactionRepository.existsById(CIRCULATION_REQUEST_ID)) {
transactionRepository.deleteById(CIRCULATION_REQUEST_ID);
}
});
Expand Down

0 comments on commit 0cafe09

Please sign in to comment.