Skip to content

Commit

Permalink
Fix code smell
Browse files Browse the repository at this point in the history
  • Loading branch information
arybakov-cgi committed Nov 27, 2023
1 parent f9c5362 commit 4fef7a7
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package ca.bc.gov.educ.api.gradbusiness;

import ca.bc.gov.educ.api.gradbusiness.exception.ServiceException;
import ca.bc.gov.educ.api.gradbusiness.model.dto.Student;
import ca.bc.gov.educ.api.gradbusiness.service.GradBusinessService;
import ca.bc.gov.educ.api.gradbusiness.util.EducGradBusinessApiConstants;
Expand Down Expand Up @@ -486,6 +487,21 @@ void testStudentTranscriptPDFByTypeByPen() throws Exception {
ResponseEntity<byte[]> transcriptPdf = gradBusinessService.getStudentTranscriptPDFByType(pen, "xml", null,"accessToken");
assertNotNull(transcriptPdf.getBody());
assertEquals(transcriptPdfSample,transcriptPdf.getBody());

when(this.webClient.post()).thenReturn(this.requestBodyUriMock);
when(this.requestBodyUriMock.uri(educGraduationApiConstants.getStudentTranscriptReportByRequest())).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.onStatus(any(), any())).thenReturn(this.responseMock);
when(this.responseMock.bodyToMono(byte[].class)).thenThrow(new ServiceException("NO_CONTENT", 204));

when(this.tokenUtils.getAccessToken()).thenReturn("accessToken");

transcriptPdf = gradBusinessService.getStudentTranscriptPDFByType(pen, "xml", null,"accessToken");
assertNotNull(transcriptPdf);
assertNull(transcriptPdf.getBody());
}

@Test
Expand Down

0 comments on commit 4fef7a7

Please sign in to comment.