### Question:
DevicePrintService { public void updateProfile(UserProfile profile, DevicePrint devicePrint) throws NotUniqueUserProfileException { profile.setSelectionCounter(profile.getSelectionCounter() + 1L); profile.setLastSelectedDate(new Date()); profile.setDevicePrint(devicePrint); saveProfile(profile); } DevicePrintService(DevicePrintAuthenticationConfig devicePrintAuthenticationConfig,
            UserProfilesDao userProfilesDao, DevicePrintExtractorFactory extractorFactory,
            DevicePrintComparator devicePrintComparator); boolean hasRequiredAttributes(DevicePrint devicePrint); DevicePrint getDevicePrint(HttpServletRequest request); UserProfile getBestMatchingUserProfile(DevicePrint devicePrint); void createNewProfile(DevicePrint devicePrint); void updateProfile(UserProfile profile, DevicePrint devicePrint);  }### Answer:
@Test public void shouldUpdateProfile() throws NotUniqueUserProfileException { UserProfile userProfile = mock(UserProfile.class); DevicePrint devicePrint = mock(DevicePrint.class); given(userProfile.getUuid()).willReturn("USER_PROFILE_UUID"); given(userProfilesDao.getProfiles()).willReturn(new ArrayList<UserProfile>()); devicePrintService.updateProfile(userProfile, devicePrint); verify(userProfile).setSelectionCounter(anyLong()); verify(userProfile).setLastSelectedDate(Matchers.<Date>anyObject()); verify(userProfile).setDevicePrint(devicePrint); verify(userProfilesDao).removeProfile(anyString()); verify(userProfilesDao).addProfile(userProfile); verify(userProfilesDao).saveProfiles(); }