Package org.jtalks.jcommune.model.entity

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


        assertEquals(result.getId(), pm.getId());
    }

    @Test
    public void testGetInvalidId() {
        PrivateMessage result = dao.get(-567890L);

        assertNull(result);
    }
View Full Code Here


    }

    @Test
    public void testUpdate() {
        String newBody = "new content";
        PrivateMessage pm = getSavedPm();
        pm.setBody(newBody);

        dao.saveOrUpdate(pm);
        session.flush();
        session.evict(pm);
        PrivateMessage result = (PrivateMessage) session.get(PrivateMessage.class, pm.getId());

        assertEquals(result.getBody(), newBody);
    }
View Full Code Here

        assertEquals(result.getBody(), newBody);
    }

    @Test
    public void testUpdateNotNullViolation() {
        PrivateMessage pm = getSavedPm();
        pm.setTitle(null);
        pm.setUserTo(null);
        pm.setBody(null);

        dao.saveOrUpdate(pm);
    }
View Full Code Here

        dao.saveOrUpdate(pm);
    }

    @Test
    public void testDelete() {
        PrivateMessage pm = getSavedPm();

        boolean result = dao.delete(pm.getId());
        int pmCount = getCount();

        assertTrue(result, "Entity is not deleted");
        assertEquals(pmCount, 0);
    }
View Full Code Here

    /**
     * Create new PrivateMessage with filled fields and save it.
     */
    private PrivateMessage getSavedPm() throws HibernateException {
        PrivateMessage pm = PersistedObjectsFactory.getDefaultPrivateMessage();
        session.saveOrUpdate(pm);
        return pm;
    }
View Full Code Here

TOP

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

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.