@Test public void ensureSyncedPersonHasCorrectAttributes() { Person person = TestDataCreator.createPerson("muster", "Marlene", "Muster", "*****@*****.**"); Person syncedPerson = ldapSyncService.syncPerson( person, Optional.of("Aljona"), Optional.of("Murygina"), Optional.of("*****@*****.**")); Mockito.verify(personService).save(Mockito.eq(person)); Assert.assertNotNull("Missing login name", syncedPerson.getLoginName()); Assert.assertNotNull("Missing first name", syncedPerson.getFirstName()); Assert.assertNotNull("Missing last name", syncedPerson.getLastName()); Assert.assertNotNull("Missing mail address", syncedPerson.getEmail()); Assert.assertEquals("Wrong login name", "muster", syncedPerson.getLoginName()); Assert.assertEquals("Wrong first name", "Aljona", syncedPerson.getFirstName()); Assert.assertEquals("Wrong last name", "Murygina", syncedPerson.getLastName()); Assert.assertEquals("Wrong mail address", "*****@*****.**", syncedPerson.getEmail()); }
@Test public void ensureSyncDoesNotEmptyAttributes() { Person person = TestDataCreator.createPerson("muster", "Marlene", "Muster", "*****@*****.**"); Person syncedPerson = ldapSyncService.syncPerson(person, Optional.empty(), Optional.empty(), Optional.empty()); Mockito.verify(personService).save(Mockito.eq(person)); Assert.assertEquals("Wrong login name", "muster", syncedPerson.getLoginName()); Assert.assertEquals("Wrong first name", "Marlene", syncedPerson.getFirstName()); Assert.assertEquals("Wrong last name", "Muster", syncedPerson.getLastName()); Assert.assertEquals("Wrong mail address", "*****@*****.**", syncedPerson.getEmail()); }