Skip to content

Commit

Permalink
add mapper tests
Browse files Browse the repository at this point in the history
  • Loading branch information
giulia-tremolada committed Nov 28, 2024
1 parent bf86684 commit 2d12e20
Showing 1 changed file with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,18 @@ void retrieveMailFromWorkContacts(){
assertEquals(EMAIL, mailFromWorkContact);
}

@Test
void retrieveMobilePhoneFromWorkContacts(){
final EmailCertifiableSchema email = new EmailCertifiableSchema(EmailCertifiableSchema.CertificationEnum.NONE, EMAIL);
final MobilePhoneCertifiableSchema phone = new MobilePhoneCertifiableSchema(MobilePhoneCertifiableSchema.CertificationEnum.NONE, MOBILE_PHONE);
WorkContactResource workContactResource = new WorkContactResource(email, phone, null);
Map<String, WorkContactResource> workContactResourceMap = Map.of(CONTACTS_UUID, workContactResource);

String phoneFromWorkContacts = userMapper.retrieveMobilePhoneFromWorkContacts(workContactResourceMap, CONTACTS_UUID);

assertEquals(MOBILE_PHONE, phoneFromWorkContacts);
}

@Test
void retrieveMailFromWorkContacts_emptyMap(){
Map<String, WorkContactResource> workContactResourceMap = new HashMap<>();
Expand All @@ -103,6 +115,15 @@ void retrieveMailFromWorkContacts_emptyMap(){
assertNull(mailFromWorkContact);
}

@Test
void retrieveMobilePhoneFromWorkContacts_emptyMap(){
Map<String, WorkContactResource> workContactResourceMap = new HashMap<>();

String phoneFromWorkContact = userMapper.retrieveMobilePhoneFromWorkContacts(workContactResourceMap, CONTACTS_UUID);

assertNull(phoneFromWorkContact);
}

@Test
void retrieveMailFromWorkContacts_nullMap(){

Expand All @@ -111,6 +132,14 @@ void retrieveMailFromWorkContacts_nullMap(){
assertNull(mailFromWorkContact);
}

@Test
void retrievePhoneFromWorkContacts_nullMap(){

String phoneFromWorkContact = userMapper.retrieveMailFromWorkContacts(null, CONTACTS_UUID);

assertNull(phoneFromWorkContact);
}

@Test
void retrieveMailFromWorkContacts_notPresent(){
final EmailCertifiableSchema email = new EmailCertifiableSchema(EmailCertifiableSchema.CertificationEnum.NONE, EMAIL);
Expand Down

0 comments on commit 2d12e20

Please sign in to comment.