use of indi.mybatis.flying.pojo.Account_ in project mybatis.flying by limeng32.
the class SelectOneTest method testSelectOne2.
/**
* 测试selectOne2
*/
@Test
@DatabaseSetup(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/selectOneTest/testSelectOne2.xml")
@ExpectedDatabase(assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/selectOneTest/testSelectOne2.result.xml")
@DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/selectOneTest/testSelectOne2.result.xml")
public void testSelectOne2() {
Account_ a1 = new Account_();
a1.setName("ann");
a1.setEmail("ann@live.cn");
accountService.insert(a1);
Account_ a2 = new Account_();
a2.setName("ann");
a2.setEmail("bob@live.cn");
accountService.insert(a2);
Account_Condition ac = new Account_Condition();
ac.setLimiter(new PageParam(1, 2));
ac.setSorter(new SortParam(new Order("id", Sequence.asc)));
ac.setName("ann");
Account_ account = accountService.selectOne(ac);
Assert.assertEquals("ann@live.cn", account.getEmail());
Assert.assertNull(ac.getLimiter());
}
use of indi.mybatis.flying.pojo.Account_ in project mybatis.flying by limeng32.
the class SelectOneTest method testSelectOne1.
/**
* 测试selectOne1
*/
@Test
@DatabaseSetup(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/selectOneTest/testSelectOne1.xml")
@ExpectedDatabase(assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/selectOneTest/testSelectOne1.result.xml")
@DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/selectOneTest/testSelectOne1.result.xml")
public void testSelectOne1() {
Account_ a1 = new Account_();
a1.setName("ann");
a1.setEmail("ann@live.cn");
accountService.insert(a1);
Account_ a2 = new Account_();
a2.setName("bob");
a2.setEmail("bob@live.cn");
accountService.insert(a2);
accountService.update(a2);
accountService.updatePersistent(a2);
Account_ account_ = accountService.select(a2.getId());
Account_ ac = new Account_();
ac.setName("bob");
ac.setEmail("bob@live.cn");
Account_ account = accountService.selectOne(ac);
Assert.assertEquals("bob@live.cn", account.getEmail());
}
use of indi.mybatis.flying.pojo.Account_ in project mybatis.flying by limeng32.
the class AccountTest method testCostumizeStatus.
/**
* 测试CostumizeStatus功能
*/
@Test
@DatabaseSetup(type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/accountTest/testCostumizeStatus.xml")
@ExpectedDatabase(assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/accountTest/testCostumizeStatus.result.xml")
@DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/accountTest/testCostumizeStatus.xml")
public void testCostumizeStatus() {
Account_ a = accountService.select(1);
Assert.assertEquals("发布", a.getStatus().text());
Account_ ac = new Account_();
ac.setStatus(StoryStatus_.p);
Collection<Account_> c = accountService.selectAll(ac);
Assert.assertEquals(1, c.size());
Account_ a2 = accountService.select(2);
Assert.assertEquals(StoryStatus_.s, a2.getStatus());
a2.setStatus(StoryStatus_.c);
accountService.update(a2);
Account_ a3 = accountService.select(3);
Assert.assertNull(a3.getStatus());
a3.setPassword("5a690d842935c51f26f473e025c1b97a");
accountService.updatePersistent(a3);
Account_ a4 = accountService.select(3);
Assert.assertNull(a4.getStatus());
}
use of indi.mybatis.flying.pojo.Account_ in project mybatis.flying by limeng32.
the class AccountTest method testDeputy.
/**
* 测试deputyRole
*/
@Test
@DatabaseSetup(type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/accountTest/testDeputy.xml")
@ExpectedDatabase(assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/accountTest/testDeputy.result.xml")
@DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/accountTest/testDeputy.xml")
public void testDeputy() {
Account_ account = accountService.select(1);
Assert.assertEquals("role1", account.getRole().getName());
Assert.assertEquals("role2", account.getRoleDeputy().getName());
Role_ rc = new Role_();
rc.setName("role1");
Role_ rdc = new Role_();
rdc.setName("role2");
Account_ ac = new Account_();
ac.setRole(rc);
ac.setRoleDeputy(rdc);
Collection<Account_> accountC = accountService.selectAll(ac);
Assert.assertEquals(1, accountC.size());
int count = accountService.count(ac);
Assert.assertEquals(1, count);
}
use of indi.mybatis.flying.pojo.Account_ in project mybatis.flying by limeng32.
the class AccountTest method testLimiter.
/**
* 测试limiter功能
*/
@Test
@DatabaseSetup(type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/accountTest/testLimiter.xml")
@DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/accountTest/testLimiter.xml")
public void testLimiter() {
Account_Condition ac = new Account_Condition();
ac.setLimiter(new PageParam(1, 2));
Collection<Account_> c = accountService.selectAll(ac);
Account_[] accounts = c.toArray(new Account_[c.size()]);
Assert.assertEquals(2, accounts.length);
Assert.assertEquals(1, accounts[0].getId().intValue());
Assert.assertEquals(2, accounts[1].getId().intValue());
Assert.assertEquals(2, ac.getLimiter().getMaxPageNum());
ac.setSorter(new SortParam(new Order(Account_Condition.field_id, Conditionable.Sequence.desc)));
c = accountService.selectAll(ac);
accounts = c.toArray(new Account_[c.size()]);
Assert.assertEquals(2, accounts.length);
Assert.assertEquals(4, accounts[0].getId().intValue());
Assert.assertEquals(3, accounts[1].getId().intValue());
}
Aggregations