Package org.cognitor.server.platform.user.domain

Examples of org.cognitor.server.platform.user.domain.User


        service.loadUserByUsername("testUser");
    }

    @Test
    public void shouldReturnUserDetailsWhenUserForUsernameGiven() {
        when(userDaoMock.load("testUser")).thenReturn(new User("testUser", "password"));

        UserDetails details = service.loadUserByUsername("testUser");

        assertEquals("testUser", details.getUsername());
        assertEquals("password", details.getPassword());
View Full Code Here


        assertTrue(details.isEnabled());
    }

    @Test(expected = IllegalStateException.class)
    public void shouldThrowExceptionWhenAlreadyExistingUserForRegistrationGiven() {
        User testUser = new User("testUser", "somePass");
        when(userDaoMock.exists(testUser)).thenReturn(true);

        service.registerUser(testUser);
    }
View Full Code Here

        service.registerUser(testUser);
    }

    @Test
    public void shouldCreateNewUserWhenNewUserForRegistrationGiven() {
        User testUser = new User("testUser", "somePass");
        when(userDaoMock.exists(testUser)).thenReturn(false);

        service.registerUser(testUser);

        verify(userDaoMock, times(1)).save(testUser);
View Full Code Here

    private UserDetails userDetails;

    @Before
    public void setUp() {
        controller = new OpenIdController(openIdManagerMock);
        User user = new User("testUser", "testPassword");
        user.setId(1L);
        userDetails = new UserDetailsImpl(user);
    }
View Full Code Here

    }

    @Override
    @Transactional
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException {
        final User user = userDao.load(username);
        if (user == null) {
            throw new UsernameNotFoundException("User " + username + " not found.");
        }
        return new UserDetailsImpl(user);
    }
View Full Code Here

            email, false, new String[] { EMAIL_EXISTS_ERROR_CODE },
            null, EMAIL_EXISTS_DEFAULT_MESSAGE);
    }

    private static User getUserFromBean(RegistrationFormBean formBean) {
        return new User(formBean.getEmail(), formBean.getPassword());
    }
View Full Code Here

TOP

Related Classes of org.cognitor.server.platform.user.domain.User

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.