Package cz.muni.fi.pa165.stis.dto

Examples of cz.muni.fi.pa165.stis.dto.UserTO


    @Test
    public void getByUsername() {
        User user3 = createUser("mrkvicka", "345sac", false);
        User user2 = createUser("Bruce", "Willis", false);
        User user1 = createUser("Peter", "Mravec", true);
        UserTO uto1 = mapper.map(user1, UserTO.class);
        UserTO uto2 = mapper.map(user2, UserTO.class);
        UserTO uto3 = mapper.map(user3, UserTO.class);
       
        when(dao.getByUsername("mrkvicka")).thenReturn(user3);              
        UserTO uto = service.getByUsername("mrkvicka");
        verify(dao).getByUsername("mrkvicka");
        assertEquals(uto, uto3);       
    }
View Full Code Here


    @Test
    public void testUpdate() {
        User user = createUser("mrkvicka", "345sac", false);
        user.setId(4L);
        UserTO uto = mapper.map(user, UserTO.class);

        service.update(uto);
        verify(dao).update(user);
    }
View Full Code Here

    @Test
    public void testRemove() {
        User user = createUser("mrkvicka", "345sac", false);
        user.setId(4L);
        UserTO uto = mapper.map(user, UserTO.class);

        service.remove(uto);
        verify(dao).remove(user);
    }
View Full Code Here

    @Test
    public void testAvailableUsername() {
        User user = createUser("mrkvicka", "345sac", false);
        user.setId(4L);
        UserTO uto = mapper.map(user, UserTO.class);

        when(dao.availableUsername("mrkvicka")).thenReturn(Boolean.FALSE);
        assertFalse("Should not be available Username", service.availableUsername("mrkvicka"));
        service.remove(uto);
        when(dao.availableUsername("mrkvicka")).thenReturn(Boolean.TRUE);
View Full Code Here

    @Test
    public void testIsAdmin() {
        User user = createUser("mrkvicka", "345sac", false);
        user.setId(4L);
        UserTO uto = mapper.map(user, UserTO.class);

        when(dao.isAdmin(user)).thenReturn(Boolean.FALSE);
        assertFalse("user should not have roleAdmin", service.isAdmin(uto));
        when(dao.isAdmin(user)).thenReturn(Boolean.TRUE);
        assertTrue("user should have roleAdmin", service.isAdmin(uto));
View Full Code Here

    @Test
    public void testMakeAdmin() {
        User user = createUser("mrkvicka", "345sac", false);
        user.setId(4L);
        UserTO uto = mapper.map(user, UserTO.class);

        when(dao.isAdmin(user)).thenReturn(Boolean.FALSE);
        assertFalse("User should not be admin", service.isAdmin(uto));
        service.makeAdmin(uto);
        verify(dao, times(1)).makeAdmin(user);
View Full Code Here

        if (id == null) {
            throw new IllegalArgumentException("id is null");
        }
       
        CustomerTO cto = cservice.get(id);
        UserTO uto = cto.getUser();       
        return new CustomerUserTO(cto, uto);
    }
View Full Code Here

        }
        if (customerUserTO.getUser().getId() == null) {
            throw new IllegalArgumentException("user.id is null");
        }
       
        UserTO userTO = customerUserTO.getUser();       
        CustomerTO customerTO = customerUserTO.getCustomer();       
       
        customerTO.setUser(userTO);      
        uservice.update(userTO);
        cservice.update(customerTO);
View Full Code Here

        return cuTOList;
    }

    @Override
    public CustomerUserTO getByUsername(String username) {
        UserTO userTO = uservice.getByUsername(username);       
        CustomerTO customerTO = cservice.getByUsername(username);
       
        return new CustomerUserTO(customerTO, userTO);
    }
View Full Code Here

        customerTO = mapper.map(customer, CustomerTO.class);       
        CustomerUserTO customerUserTO = new CustomerUserTO(customerTO, userTO);
        customerTO.setUser(userTO)
               
        User user2 = createUser("ferko22", "bak!s$#", false);
        UserTO userTO2 = mapper.map(user2, UserTO.class);       
        Customer customer2 = createCustomer(null, "Petko", "Mravcek", "Teplicka nad Vahom 142", "772222222");
        CustomerTO customerTO2 = mapper.map(customer2, CustomerTO.class);       
        CustomerUserTO customerUserTO2 = new CustomerUserTO(customerTO2, userTO2);
        customerTO2.setUser(userTO2)
       
View Full Code Here

TOP

Related Classes of cz.muni.fi.pa165.stis.dto.UserTO

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.