Code example for AbstractTransactionalTestNGSpringContextTests

Methods: assertNull

0
 
    @Test 
    public void testGetInvalidId() { 
        UserContactType type = dao.get(-12345L); 
 
        assertNull(type); 
    } 
 
    @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());