-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GRAD2-3191 - Update institute cache to use DisplayName without specia…
…l characters (#391) * GRAD2-3191 - Update institute cache to use DisplayName without special characters * GRAD2-3191 - Adding test coverage * GRAD2-3191 - Adding test coverage
- Loading branch information
1 parent
7220a72
commit 0c5e2ec
Showing
4 changed files
with
43 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -112,23 +112,35 @@ public ClientRegistration findByRegistrationId(String registrationId) { | |
|
||
@Test | ||
void whenGetSchoolsFromInstituteApi_returnsListOfSchools() { | ||
List<SchoolEntity> schools = new ArrayList<>(); | ||
SchoolEntity school = new SchoolEntity(); | ||
List<SchoolEntity> schoolEntities = new ArrayList<>(); | ||
SchoolEntity schoolEntity = new SchoolEntity(); | ||
|
||
schoolEntity.setSchoolId("ID"); | ||
schoolEntity.setDistrictId("DistID"); | ||
schoolEntity.setSchoolNumber("12345"); | ||
schoolEntity.setSchoolCategoryCode("SCC"); | ||
schoolEntity.setEmail("[email protected]"); | ||
schoolEntity.setDisplayName("Tk̓emlúps te Secwépemc"); | ||
schoolEntity.setDisplayNameNoSpecialChars("Tkkemlups te Secwepemc"); | ||
schoolEntities.add(schoolEntity); | ||
|
||
List<School> schools = new ArrayList<>(); | ||
School school = new School(); | ||
school.setSchoolId("ID"); | ||
school.setDistrictId("DistID"); | ||
school.setSchoolNumber("12345"); | ||
school.setSchoolCategoryCode("SCC"); | ||
school.setEmail("[email protected]"); | ||
|
||
school.setDisplayName("Tk̓emlúps te Secwépemc"); | ||
school.setDisplayNameNoSpecialChars("Tkkemlups te Secwepemc"); | ||
schools.add(school); | ||
|
||
when(this.restUtils.getTokenResponseObject(anyString(), anyString())) | ||
.thenReturn(responseObjectMock); | ||
when(webClientMock.get()) | ||
.thenReturn(requestHeadersUriSpecMock); | ||
when(this.schoolTransformer.transformToDTO(schoolEntities)).thenReturn(schools); | ||
when(this.restServiceMock.get(constants.getAllSchoolsFromInstituteApiUrl(), | ||
List.class, instWebClient)).thenReturn(schoolEntities); | ||
|
||
schoolService.getSchoolsFromInstituteApi(); | ||
List<School> result = schoolService.getSchoolsFromInstituteApi(); | ||
assertEquals(schools, result); | ||
} | ||
|
||
@Test | ||
|
@@ -310,11 +322,11 @@ void whenGetSchoolDetailsFromInstituteApi_returnsListOfSchoolDetails() { | |
schoolDetailEntity1.setSchoolCategoryCode("SCC"); | ||
schoolDetailEntity1.setEmail("[email protected]"); | ||
SchoolDetailEntity schoolDetailEntity2 = new SchoolDetailEntity(); | ||
schoolDetailEntity1.setSchoolId("2"); | ||
schoolDetailEntity1.setDistrictId("DistID"); | ||
schoolDetailEntity1.setSchoolNumber("12345"); | ||
schoolDetailEntity1.setSchoolCategoryCode("SCC"); | ||
schoolDetailEntity1.setEmail("[email protected]"); | ||
schoolDetailEntity2.setSchoolId("2"); | ||
schoolDetailEntity2.setDistrictId("DistID"); | ||
schoolDetailEntity2.setSchoolNumber("12345"); | ||
schoolDetailEntity2.setSchoolCategoryCode("SCC"); | ||
schoolDetailEntity2.setEmail("[email protected]"); | ||
|
||
when(this.schoolService.getSchoolsFromRedisCache()).thenReturn(schools); | ||
when(this.schoolDetailTransformer.transformToDTO(schoolDetailEntity1)).thenReturn(schoolDetail1); | ||
|
@@ -338,13 +350,17 @@ void whenGetSchoolDetailByIdFromInstituteApi_ReturnSchoolDetail() { | |
schoolDetail.setSchoolNumber("12345"); | ||
schoolDetail.setSchoolCategoryCode("SCC"); | ||
schoolDetail.setEmail("[email protected]"); | ||
schoolDetail.setDisplayName("Stitó:s Lá:lém Totí:lt Elementary"); | ||
schoolDetail.setDisplayNameNoSpecialChars("Stitos Lalem Totilt Elementary"); | ||
|
||
SchoolDetailEntity schoolDetailEntity = new SchoolDetailEntity(); | ||
schoolDetailEntity.setSchoolId("1"); | ||
schoolDetailEntity.setDistrictId("DistID"); | ||
schoolDetailEntity.setSchoolNumber("12345"); | ||
schoolDetailEntity.setSchoolCategoryCode("SCC"); | ||
schoolDetailEntity.setEmail("[email protected]"); | ||
schoolDetailEntity.setDisplayName("Stitó:s Lá:lém Totí:lt Elementary"); | ||
schoolDetailEntity.setDisplayNameNoSpecialChars("Stitos Lalem Totilt Elementary"); | ||
|
||
when(this.schoolDetailTransformer.transformToDTO(schoolDetailEntity)).thenReturn(schoolDetail); | ||
when(this.restServiceMock.get(String.format(constants.getSchoolDetailsByIdFromInstituteApiUrl(), "1"), | ||
|