Skip to content

Commit

Permalink
Fixed the broken unit tests.
Browse files Browse the repository at this point in the history
Fixed the broken unit tests.
  • Loading branch information
infstar committed Nov 18, 2024
1 parent e776a43 commit 15ad4c8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public void testGetSchoolClob() {
assertThat(result).isNotNull();
assertThat(result.getSchoolId()).isEqualTo(schoolDetail.getSchoolId());
assertThat(result.getMinCode()).isEqualTo(schoolDetail.getMincode());
assertThat(result.getSchoolCategoryCode()).isEqualTo(schoolCategoryLegacyCode);
assertThat(result.getSchoolCategoryLegacyCode()).isEqualTo(schoolCategoryLegacyCode);
assertThat(result.getDistrictName()).isNotNull();
assertThat(result.getAddress1()).isNotNull();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ public void whenGetDistrictByIdFromRedisCache_ReturnDistrict() {

when(this.districtRedisRepository.findById("ID"))
.thenReturn(Optional.of(districtEntity));
when(this.districtTransformerMock.transformToDTO(Optional.of(districtEntity)))
when(this.districtTransformerMock.transformToDTO(districtEntity))
.thenReturn(district);
assertEquals(district, districtService.getDistrictByIdFromRedisCache("ID"));
}
Expand Down Expand Up @@ -390,15 +390,15 @@ public void whenGetDistrictsBySchoolCategoryCode_ReturnDistricts() {
schoolDetail.setSchoolId("ID");
schoolDetail.setDistrictId("DistID");
schoolDetail.setSchoolNumber("12345");
schoolDetail.setSchoolCategoryCode("SCC");
schoolDetail.setSchoolCategoryCode(schoolCategoryCode);
schoolDetail.setEmail("[email protected]");
schoolDetails.add(schoolDetail);

schoolDetail = new SchoolDetail();
schoolDetail.setSchoolId("ID");
schoolDetail.setDistrictId("DistID");
schoolDetail.setSchoolNumber("12345");
schoolDetail.setSchoolCategoryCode("SCC");
schoolDetail.setSchoolCategoryCode(schoolCategoryCode);
schoolDetail.setEmail("[email protected]");
schoolDetails.add(schoolDetail);

Expand All @@ -407,15 +407,15 @@ public void whenGetDistrictsBySchoolCategoryCode_ReturnDistricts() {
schoolDetailEntity.setSchoolId("ID");
schoolDetailEntity.setDistrictId("DistID");
schoolDetailEntity.setSchoolNumber("12345");
schoolDetailEntity.setSchoolCategoryCode("SCC");
schoolDetailEntity.setSchoolCategoryCode(schoolCategoryCode);
schoolDetailEntity.setEmail("[email protected]");
schoolDetailEntities.add(schoolDetailEntity);

schoolDetailEntity = new SchoolDetailEntity();
schoolDetailEntity.setSchoolId("ID");
schoolDetailEntity.setDistrictId("DistID");
schoolDetailEntity.setSchoolNumber("12345");
schoolDetailEntity.setSchoolCategoryCode("SCC");
schoolDetailEntity.setSchoolCategoryCode(schoolCategoryCode);
schoolDetailEntity.setEmail("[email protected]");
schoolDetailEntities.add(schoolDetailEntity);

Expand All @@ -424,7 +424,9 @@ public void whenGetDistrictsBySchoolCategoryCode_ReturnDistricts() {
.thenReturn(schoolDetailEntities);
when(this.schoolDetailTransformer.transformToDTO(schoolDetailEntities))
.thenReturn(schoolDetails);
when(this.districtService.getDistrictByIdFromRedisCache("ID"))
when(this.districtRedisRepository.findById("DistID"))
.thenReturn(Optional.of(districtEntity));
when(this.districtService.getDistrictByIdFromRedisCache("DistID"))
.thenReturn(district);
when(this.districtTransformerMock.transformToDTO(districtEntities))
.thenReturn(districts);
Expand Down

0 comments on commit 15ad4c8

Please sign in to comment.