Dao?????????
???????????? ???????[ 2012/8/7 14:40:17 ] ????????
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd">
<bean id="dataSource" class="org.unitils.database.UnitilsDataSourceFactoryBean" />
</beans>
????4??????????????
???????????dbunit??xml?????????????????????ExportData????????????????в???????????????????????????????????????????????????????????????????xml
?????????xml????????test/resources?o?????????????package?У?????test/resources/com/xxx/dao/???
????5????????????????д
?????????????????????UnitilsJUnit3??????????????????????????????Junit3???Unitils?????????UnitilsJUnit4???????????????????????????????
????Java????
public class AccountDaoTest extends UnitilsJUnit3 {
@SpringApplicationContext({ "classpath:testapplication/appContext-common.xml"??
"classpath:testapplication/testDatasource.xml"?? "classpath:META-INF/spring/applicationContext-*.xml" })
protected ApplicationContext applicationContext;
@SpringBeanByType
private AccountDao accountDao;
@DataSet("ACCOUNT.xml")
public void testGetAccount() {
Account account = accountDao.getAccount("S31993k");
System.out.println(JSON.toJSON(account));
assertEquals(100?? account.getBalance());
}
@DataSet("ACCOUNT.xml")
public void testGetAccountNull() {
Account account = accountDao.getAccount("23");
assertEquals(null?? account);
}
@DataSet("ACCOUNT.xml")
@ExpectedDataSet("ACCOUNT_NEW.xml")
public void testUpdateAccount() {
accountDao.updateAccount("S31993k"?? 35);
}
}
??????
???·???
??????????????????
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