Skip to content

Commit

Permalink
[MODFIN-344] - Increased unit tests coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Khamidulla Abdulkhakimov authored and Khamidulla Abdulkhakimov committed Jan 3, 2024
1 parent d22f9b3 commit b65bd26
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/test/java/org/folio/rest/impl/BudgetsApiTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,27 @@ void getFinanceBudgetsExpenseClassesTotalsByIdWithError() {
verify(budgetExpenseClassTotalsMockService).getExpenseClassTotals(eq(budgetId), ArgumentMatchers.any());
}

@Test
void postFinanceBudgetsRecalculateById() {
when(recalculateBudgetMockService.recalculateBudget(anyString(), ArgumentMatchers.any())).thenReturn(succeededFuture());
String budgetId = UUID.randomUUID().toString();

RestTestUtils.verifyPostResponse(String.format("/finance/budgets/%s/recalculate", budgetId), null, APPLICATION_JSON, 200);

verify(recalculateBudgetMockService).recalculateBudget(eq(budgetId), ArgumentMatchers.any());
}

@Test
void postFinanceBudgetsRecalculateByIdWithError() {
Future<Void> failedFuture = Future.failedFuture(new HttpException(400, GENERIC_ERROR_CODE));
when(recalculateBudgetMockService.recalculateBudget(anyString(), ArgumentMatchers.any())).thenReturn(failedFuture);
String budgetId = UUID.randomUUID().toString();

RestTestUtils.verifyPostResponse(String.format("/finance/budgets/%s/recalculate", budgetId), null, APPLICATION_JSON, 400);

verify(recalculateBudgetMockService).recalculateBudget(eq(budgetId), ArgumentMatchers.any());
}

/**
* Define unit test specific beans to override actual ones
*/
Expand Down

0 comments on commit b65bd26

Please sign in to comment.