@Test public void username_is_set_no_empty_string_is_thrown_probably() { createFullUser("ietiuuitp"); createUpdateUserWithEmptyUserName(); updateUser(); assertThat(returnUser.getUserName(), is(equalTo(testUser.getUserName()))); }
@Test public void testFindUser() throws Exception { // Stub the value that will returned on call to userService.findUserByName User stubbedUser = new User("userAfterSave"); Mockito.when(userService.findUserByName("user1")).thenReturn(stubbedUser); // make the call User user = userManager.findUser("user1"); // Verify if findUserByName method was invoked on userService call Mockito.verify(userService).findUserByName("user1"); Assert.assertEquals("userAfterSave", user.getUserName()); }
@Test public void update_all_single_values() { createFullUser("uasv"); createUpdateUserWithUpdateFields(); updateUser(); assertEquals("UserName", returnUser.getUserName()); assertEquals("NickName", returnUser.getNickName()); assertNotEquals(testUser.isActive(), returnUser.isActive()); assertEquals("DisplayName", returnUser.getDisplayName()); assertEquals("ExternalId", returnUser.getExternalId()); assertEquals("Locale", returnUser.getLocale()); assertEquals("PreferredLanguage", returnUser.getPreferredLanguage()); assertEquals("ProfileUrl", returnUser.getProfileUrl()); assertEquals("Timezone", returnUser.getTimezone()); assertEquals("Title", returnUser.getTitle()); assertEquals("UserType", returnUser.getUserType()); assertEquals("FamilyName", returnUser.getName().getFamilyName()); assertEquals("ExternalId", returnUser.getExternalId()); }