Search in sources :

Example 41 with Account_

use of indi.mybatis.flying.pojo.Account_ in project mybatis.flying by limeng32.

the class NullOrNotTest method testNullOrNot.

/**
 * 测试NullOrNot关键字
 */
@Test
@DatabaseSetup(type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/nullOrNotTest/testNullOrNot.xml")
@ExpectedDatabase(assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/nullOrNotTest/testNullOrNot.result.xml")
@DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/nullOrNotTest/testNullOrNot.xml")
public void testNullOrNot() {
    Account_Condition ac = new Account_Condition();
    ac.setEmailIsNull(true);
    Collection<Account_> accountC = accountService.selectAll(ac);
    Assert.assertEquals(1, accountC.size());
    int count = accountService.count(ac);
    Assert.assertEquals(1, count);
    Account_Condition ac2 = new Account_Condition();
    ac2.setEmailIsNull(false);
    Collection<Account_> accountC2 = accountService.selectAll(ac2);
    Assert.assertEquals(1, accountC2.size());
    int count2 = accountService.count(ac2);
    Assert.assertEquals(1, count2);
    Account_Condition ac3 = new Account_Condition();
    Collection<Account_> accountC3 = accountService.selectAll(ac3);
    Assert.assertEquals(2, accountC3.size());
    int count3 = accountService.count(ac3);
    Assert.assertEquals(2, count3);
    Account_Condition ac4 = new Account_Condition();
    ac4.setRoleIsNull(true);
    Collection<Account_> accountC4 = accountService.selectAll(ac4);
    for (Account_ a : accountC4) {
        Assert.assertEquals("bob", a.getName());
    }
    int count4 = accountService.count(ac4);
    Assert.assertEquals(1, count4);
    Account_Condition ac5 = new Account_Condition();
    ac5.setRoleIsNull(false);
    Collection<Account_> accountC5 = accountService.selectAll(ac5);
    for (Account_ a : accountC5) {
        Assert.assertEquals("ann", a.getName());
    }
    int count5 = accountService.count(ac5);
    Assert.assertEquals(1, count5);
}
Also used : Account_Condition(indi.mybatis.flying.pojo.condition.Account_Condition) Account_(indi.mybatis.flying.pojo.Account_) ExpectedDatabase(com.github.springtestdbunit.annotation.ExpectedDatabase) Test(org.junit.Test) DatabaseSetup(com.github.springtestdbunit.annotation.DatabaseSetup) DatabaseTearDown(com.github.springtestdbunit.annotation.DatabaseTearDown)

Example 42 with Account_

use of indi.mybatis.flying.pojo.Account_ in project mybatis.flying by limeng32.

the class SelectOneTest method testSelectOne3.

/**
 * 测试selectOne3,缓存测试
 */
@Test
@DatabaseSetup(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/selectOneTest/testSelectOne3.xml")
@ExpectedDatabase(assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/selectOneTest/testSelectOne3.result.xml")
@DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/selectOneTest/testSelectOne3.result.xml")
public void testSelectOne3() {
    Account_ a1 = new Account_();
    a1.setName("ann");
    accountService.insert(a1);
    Account_ a2 = new Account_();
    a2.setName("bob");
    accountService.insert(a2);
    Account_ ac = new Account_();
    Account_ account1 = accountService.selectOne(ac);
    Assert.assertEquals("ann", account1.getName());
    Collection<Account_> accountC = accountService.selectAll(ac);
    Assert.assertEquals(2, accountC.size());
}
Also used : Account_(indi.mybatis.flying.pojo.Account_) ExpectedDatabase(com.github.springtestdbunit.annotation.ExpectedDatabase) Test(org.junit.Test) DatabaseSetup(com.github.springtestdbunit.annotation.DatabaseSetup) DatabaseTearDown(com.github.springtestdbunit.annotation.DatabaseTearDown)

Aggregations

Account_ (indi.mybatis.flying.pojo.Account_)42 Test (org.junit.Test)38 DatabaseTearDown (com.github.springtestdbunit.annotation.DatabaseTearDown)36 DatabaseSetup (com.github.springtestdbunit.annotation.DatabaseSetup)25 ExpectedDatabase (com.github.springtestdbunit.annotation.ExpectedDatabase)25 Account_Condition (indi.mybatis.flying.pojo.condition.Account_Condition)18 IfProfileValue (org.springframework.test.annotation.IfProfileValue)18 Role_ (indi.mybatis.flying.pojo.Role_)17 LoginLog_ (indi.mybatis.flying.pojo.LoginLog_)8 HashMap (java.util.HashMap)8 DatabaseSetups (com.github.springtestdbunit.annotation.DatabaseSetups)6 DatabaseTearDowns (com.github.springtestdbunit.annotation.DatabaseTearDowns)6 ExpectedDatabases (com.github.springtestdbunit.annotation.ExpectedDatabases)6 PageParam (indi.mybatis.flying.pagination.PageParam)6 Order (indi.mybatis.flying.pagination.Order)4 SortParam (indi.mybatis.flying.pagination.SortParam)4 ArrayList (java.util.ArrayList)4 LoginLogSource2 (indi.mybatis.flying.pojo.LoginLogSource2)3 Page (indi.mybatis.flying.pagination.Page)2 Account2_ (indi.mybatis.flying.pojo.Account2_)2