package com.min.vacation.business.dao;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.min.vacation.business.model.User;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "/applicationContext-dao.xml" })
public class UserDaoImplTest extends AbstractTransactionalJUnit4SpringContextTests {

    @Autowired
    private UserDao userDao;

    @Test
    public void testGetUserByUsernameWithValidUsername() {
        User user = userDao.getUserByUsername("wpetit");
        assertNotNull(user);
        assertEquals(0, user.getId());
        assertEquals("wpetit", user.getUsername());
    }

    @Test
    public void testGetUserByUsernameWithInvalidUsername() {
        User user = userDao.getUserByUsername("wpetit0");
        assertNull(user);
    }

}

@@ -724,16 +724,25 @@
  extends
+%0D%0A       
  Abstrac
@@ -829,24 +829,395 @@
 userDao;%0D%0A%0D%0A
+    @Test%0D%0A    public void testSaveUser() %7B%0D%0A        User user = new User();%0D%0A        user.setUsername(%22wpetit1%22);%0D%0A        userDao.save(user);%0D%0A%0D%0A        User userRetrieved = userDao.getUserByUsername(%22wpetit%22);%0D%0A        assertNotNull(userRetrieved);%0D%0A        assertNotNull(userRetrieved.getId());%0D%0A        assertEquals(%22wpetit%22, userRetrieved.getUsername());%0D%0A    %7D%0D%0A%0D%0A
     @Test%0D%0A 

Add user dao tests