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 f9732d9 commit 8cd4af8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import java.util.List;

@Slf4j
public class RegenerateSchoolReportsReader implements ItemReader<List<String>> {
public class RegenerateSchoolReportsReader extends BaseReader implements ItemReader<List<String>> {

@Value("#{stepExecutionContext['data']}")
List<String> schools;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -903,18 +903,7 @@ public void testcreateAndStoreSchoolReports_0() {
@Test
public void testcreateAndStoreSchoolReports_WithParams() {
final String type = "TVRRUN";

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);

mockTokenResponseObject();

var result = this.restUtils.createAndStoreSchoolReports(Arrays.asList("12345"), type, new DistributionSummaryDTO());
assertNotNull(type);
assertNotNull(result);
Expand All @@ -923,17 +912,7 @@ public void testcreateAndStoreSchoolReports_WithParams() {
@Test(expected = Exception.class)
public void testcreateAndStoreSchoolReports_WithParams_ThenThrowException() {
final String type = "TVRRUN";

when(this.webClient.post()).thenThrow(Exception.class);
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);

mockTokenResponseObject();

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

0 comments on commit 8cd4af8

Please sign in to comment.