Skip to content

Commit

Permalink
feat: add-back and re-factor secondary code check
Browse files Browse the repository at this point in the history
  • Loading branch information
trev-dev committed Sep 15, 2023
1 parent cf535b5 commit a770708
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,30 @@ void findPrimaryEdxActivationCodeOutOfManyForDistrict() {
assertThat(found.getIsPrimary()).isTrue();
}

@Test
void findPrimaryEdxActivationCodeOnlyReturnsPrimaryEdxActivationCodeForSchool() {
EdxActivationCodeEntity mockActivationCode = this.createEdxActivationCodeEntity(
UUID.randomUUID().toString(), false, true, UUID.randomUUID(), 0, UUID.randomUUID(), null);
EdxActivationCodeEntity secondaryActivationCode = this.edxActivationCodeRepository.save(mockActivationCode);

assertThrows(EntityNotFoundException.class, () -> {
this.service
.findPrimaryEdxActivationCode(InstituteTypeCode.SCHOOL, secondaryActivationCode.getSchoolID().toString());
});
}

@Test
void findPrimaryEdxActivationCodeOnlyReturnsPrimaryEdxActivationCodeForDistrict() {
EdxActivationCodeEntity mockActivationCode = this.createEdxActivationCodeEntity(
UUID.randomUUID().toString(), false, true, UUID.randomUUID(), 0, null, UUID.randomUUID());
EdxActivationCodeEntity secondaryActivationCode = this.edxActivationCodeRepository.save(mockActivationCode);

assertThrows(EntityNotFoundException.class, () -> {
this.service
.findPrimaryEdxActivationCode(InstituteTypeCode.DISTRICT, secondaryActivationCode.getDistrictID().toString());
});
}

@Test
void findPrimaryEdxActivationCodeCannotFindNonExistingEdxActivationCodeForSchool() {
String uuid = UUID.randomUUID().toString();
Expand Down

0 comments on commit a770708

Please sign in to comment.