?????????·??????????????????????
???????????? ???????[ 2013/7/19 13:21:56 ] ????????
???????????????????
package com.noyaxe.myapp.repository;
import com.github.springtestdbunit.annotation.DatabaseSetup;
import com.noyaxe.myapp.entity.Floor;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.support.DependencyInjectionTestExecutionListener;
import org.springframework.test.context.support.DirtiesContextTestExecutionListener;
import java.util.List;
import static junit.framework.Assert.assertNull;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:applicationContext-test.xml")
@TestExecutionListeners({
DependencyInjectionTestExecutionListener.class??
DirtiesContextTestExecutionListener.class??
TransactionDbUnitTestExecutionListener.class})
public class FloorDaoTest {
@Autowired
private FloorDao floorDao;
@Test
<PRE class=java name="code"> @DatabaseSetup("FloorDao-findbByBuidlingName-dataset.xml")</PRE> public void testFindByBuildingName(){ List<Floor> singleFloorList = floorDao.findByBuildingName("SOHO"); assertEquals(1?? singleFloorList.size()); List<Floor> twoFloorList = floorDao.findByBuildingName("New Gate Plaza"); assertEquals(2?? twoFloorList.size()); List<Floor> emptyFloorList = floorDao.findByBuildingName("Test"); assertEquals(0?? emptyFloorList.size()); } @Test<BR><PRE class=java name="code"> @DatabaseSetup("FloorDao-findbByBuidlingNameAndFloorNum-dataset.xml")</PRE> public void testFindByBuildingNameAndFloorNum(){ Floor floor = floorDao.findByBuildingNameAndFloorNum("SOHO"?? 2); assertNotNull(floor); Floor empty = floorDao.findByBuildingNameAndFloorNum("New Gate Plaza"?? 7); assertNull(empty); empty = floorDao.findByBuildingNameAndFloorNum("No Building"?? 7); assertNull(empty); }}
???????????????????????????DatabaseSetup?????????????????????????????????????????????????????е?????????????????????????????????????????DatabaseSetup?????????????
????????????????????????????????????????????????С???????????????????????????????????????????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11