Skip to content

Commit

Permalink
GRAD2-2822: School Report Regeneration Process - Backend Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kamal-mohammed committed Sep 9, 2024
1 parent 8cd4af8 commit a0efef6
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -901,16 +901,25 @@ public void testcreateAndStoreSchoolReports_0() {
assertNotNull(result);
}
@Test
public void testcreateAndStoreSchoolReports_WithParams() {
public void whenCreateAndStoreSchoolReports_WithParams_ThenReturnResult() {
final String type = "TVRRUN";
mockTokenResponseObject();

when(this.webClient.post()).thenReturn(this.requestBodyUriMock);
when(this.requestBodyUriMock.uri(String.format(constants.getCreateAndStoreSchoolReports(),type))).thenReturn(this.requestBodyUriMock);
when(this.requestBodyUriMock.headers(any(Consumer.class))).thenReturn(this.requestBodyMock);
when(this.requestBodyMock.contentType(any())).thenReturn(this.requestBodyMock);
when(this.requestBodyMock.body(any(BodyInserter.class))).thenReturn(this.requestHeadersMock);
when(this.requestHeadersMock.retrieve()).thenReturn(this.responseMock);
when(this.responseMock.bodyToMono(Integer.class)).thenReturn(Mono.just(0));
when(LOGGER.isDebugEnabled()).thenReturn(true);

var result = this.restUtils.createAndStoreSchoolReports(Arrays.asList("12345"), type, new DistributionSummaryDTO());
assertNotNull(type);
assertNotNull(result);
}

@Test(expected = Exception.class)
public void testcreateAndStoreSchoolReports_WithParams_ThenThrowException() {
public void whenCreateAndStoreSchoolReports_WithParams_ThenThrowException() {
final String type = "TVRRUN";
when(this.webClient.post()).thenThrow(Exception.class);

Expand Down

0 comments on commit a0efef6

Please sign in to comment.