use of com.github.springtestdbunit.annotation.DatabaseSetup in project mybatis.flying by limeng32.
the class ConditionInTest method testConditionIn.
/**
* 测试无外键情况下condition:in功能
*/
@Test
@DatabaseSetup(type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/conditionInTest/testConditionIn.xml")
@DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/conditionInTest/testConditionIn.xml")
public void testConditionIn() {
Account_Condition ac = new Account_Condition();
List<String> nameC = new ArrayList<>();
nameC.add("ann");
ac.setNameIn(nameC);
Collection<Account_> c = accountService.selectAll(ac);
Assert.assertEquals(1, c.size());
nameC.add("bob");
Collection<Account_> c2 = accountService.selectAll(ac);
Assert.assertEquals(2, c2.size());
List<String> nameC2 = new ArrayList<>();
ac.setNameIn(nameC2);
Collection<Account_> c3 = accountService.selectAll(ac);
Assert.assertEquals(2, c3.size());
}
use of com.github.springtestdbunit.annotation.DatabaseSetup in project mybatis.flying by limeng32.
the class ConditionInTest method testConditionIn4.
/**
* 测试无外键情况下condition:in功能且变量类型为时间的情况
*/
@Test
@DatabaseSetup(type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/conditionInTest/testConditionIn4.xml")
@ExpectedDatabase(assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/conditionInTest/testConditionIn4.xml")
@DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/conditionInTest/testConditionIn4.xml")
public void testConditionIn4() {
LoginLog_Condition lc = new LoginLog_Condition();
List<Date> timeC = new ArrayList<>();
Calendar c = Calendar.getInstance(), c2 = Calendar.getInstance();
c.clear();
c2.clear();
c.set(1970, 0, 1, 8, 0, 0);
c2.set(1970, 0, 1, 8, 0, 1);
timeC.add(c.getTime());
timeC.add(c2.getTime());
lc.setLoginTimeIn(timeC);
int count = loginLogService.count(lc);
Assert.assertEquals(2, count);
}
use of com.github.springtestdbunit.annotation.DatabaseSetup in project mybatis.flying by limeng32.
the class ConditionInTest method testConditionIn3.
/**
* 测试无外键情况下condition:in功能且变量类型为数字的情况
*/
@Test
@DatabaseSetup(type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/conditionInTest/testConditionIn3.xml")
@DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/conditionInTest/testConditionIn3.xml")
public void testConditionIn3() {
Account_Condition ac = new Account_Condition();
List<Integer> opLockC = new ArrayList<>();
opLockC.add(1);
opLockC.add(2);
ac.setOpLockIn(opLockC);
int count = accountService.count(ac);
Assert.assertEquals(2, count);
}
use of com.github.springtestdbunit.annotation.DatabaseSetup in project mybatis.flying by limeng32.
the class ConditionInTest method testConditionIn2.
/**
* 测试有外键情况下condition:in功能
*/
@Test
@DatabaseSetup(type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/conditionInTest/testConditionIn2.xml")
@DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/conditionInTest/testConditionIn2.xml")
public void testConditionIn2() {
LoginLog_Condition lc = new LoginLog_Condition();
List<String> loginIpC = new ArrayList<>();
loginIpC.add("11");
loginIpC.add("22");
lc.setLoginIPIn(loginIpC);
Account_Condition ac = new Account_Condition();
List<String> nameC = new ArrayList<>();
nameC.add("ann");
nameC.add("bob");
ac.setNameIn(nameC);
lc.setAccount(ac);
Collection<LoginLog_> c = loginLogService.selectAll(lc);
Assert.assertEquals(2, c.size());
int count = loginLogService.count(lc);
Assert.assertEquals(2, count);
}
use of com.github.springtestdbunit.annotation.DatabaseSetup in project mybatis.flying by limeng32.
the class ConditionNotInTest method testConditionNotIn2.
/**
* 测试有外键情况下condition:notIn功能
*/
@Test
@DatabaseSetup(type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/conditionNotInTest/testConditionIn2.xml")
@DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/conditionNotInTest/testConditionIn2.xml")
public void testConditionNotIn2() {
LoginLog_Condition lc = new LoginLog_Condition();
Account_Condition ac = new Account_Condition();
List<String> nameC = new ArrayList<>();
nameC.add("ann");
nameC.add("bob");
ac.setNameNotIn(nameC);
lc.setAccount(ac);
Collection<LoginLog_> c = loginLogService.selectAll(lc);
Assert.assertEquals(0, c.size());
int count = loginLogService.count(lc);
Assert.assertEquals(0, count);
}
Aggregations