bunti/src/test/java/de/ctdo/bunti/dao/RoomsDAOImplTest.java

36 lines
928 B
Java

package de.ctdo.bunti.dao;
import de.ctdo.bunti.model.Room;
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.SpringJUnit4ClassRunner;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNull;
@ContextConfiguration()
@RunWith(SpringJUnit4ClassRunner.class)
public class RoomsDAOImplTest {
@Autowired
RoomsDAO dut;
@Test
// @Transactional
public void testGetRooms() throws Exception {
assertEquals(4, dut.getRooms().size());
}
@Test
public void testGetRoomKueche() throws Exception {
assertEquals("Kueche", dut.getRoom(1).getName());
}
@Test
public void testGetRoomKuecheError() throws Exception {
assertNull(dut.getRoom(23));
}
}