Package org.jtalks.jcommune.model.entity

Examples of org.jtalks.jcommune.model.entity.UserContactType


        contact.setOwner(owner);
        return contact;
    }

    private UserContactType createUserContactType(){
        UserContactType userContactType = new UserContactType();
        userContactType.setIcon(ICON);
        userContactType.setTypeName(TYPENAME);
        return userContactType;
    }
View Full Code Here


    @Test
    public void getUserContactsShouldReturnContactsFromDto() {
        UserContactDto contact = new UserContactDto();
        contact.setId(1L);
        contact.setValue("value");
        contact.setType(new UserContactType());
        List<UserContactDto> contactList = new ArrayList<>();
        contactList.add(contact);

        UserContactsDto contactsDto = new UserContactsDto();
        contactsDto.setContacts(contactList);
View Full Code Here

    public void testSave() {
    }

    @Test
    public void testGet() {
        UserContactType type = ObjectsFactory.getDefaultUserContactType();
        dao.saveOrUpdate(type);
        UserContactType result = dao.get(type.getId());
        assertNotNull(result);
        assertEquals(type.getId(), result.getId());
        assertEquals(type.getIcon(), result.getIcon());
        assertEquals(type.getTypeName(), result.getTypeName());
        assertEquals(type.getMask(), result.getMask());
        assertEquals(type.getDisplayPattern(), result.getDisplayPattern());
        assertEquals(type.getValidationPattern(), result.getValidationPattern());
    }
View Full Code Here

        assertEquals(type.getValidationPattern(), result.getValidationPattern());
    }

    @Test
    public void testGetInvalidId() {
        UserContactType type = dao.get(-12345L);

        assertNull(type);
    }
View Full Code Here

    @Test
    public void testUpdate() {
        String newName = "New contact type";
        String newIcon = "/new/icon";
        UserContactType type = ObjectsFactory.getDefaultUserContactType();
        session.save(type);
        type.setTypeName(newName);
        type.setIcon(newIcon);
        dao.saveOrUpdate(type);
        session.flush();
        session.evict(type);
        UserContactType result = (UserContactType) session.get(UserContactType.class, type.getId());
        assertNotNull(result);
        assertEquals(type.getId(), result.getId());
        assertEquals(type.getIcon(), result.getIcon());
        assertEquals(type.getTypeName(), result.getTypeName());
        assertEquals(type.getMask(), result.getMask());
        assertEquals(type.getDisplayPattern(), result.getDisplayPattern());
        assertEquals(type.getValidationPattern(), result.getValidationPattern());

    }
View Full Code Here

    }

    @Test
    public void testGetAvailableContactTypes() {
        UserContactType type = ObjectsFactory.getDefaultUserContactType();
        session.saveOrUpdate(type);
        session.clear();

        List<UserContactType> types = dao.getAvailableContactTypes();
        assertReflectionEquals(type, types.get(0));
View Full Code Here

TOP

Related Classes of org.jtalks.jcommune.model.entity.UserContactType

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.