use of indi.mybatis.flying.pojo.Detail_ in project mybatis.flying by limeng32.
the class CacheTest method test3.
@Test
@IfProfileValue(name = "CACHE", value = "true")
@DatabaseSetup(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/cacheTest/test3.xml")
@ExpectedDatabase(assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/cacheTest/test3.result.xml")
@DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/cacheTest/test3.result.xml")
public void test3() {
String name = "新权限", newName = "新角色", newName2 = "新新角色", accountName = "ann", ip = "0.0.0.1", detailName = "细节";
Role_ r = new Role_();
r.setName(name);
roleService.insert(r);
Account_ a = new Account_();
a.setName(accountName);
a.setRole(r);
accountService.insert(a);
LoginLog_ l = new LoginLog_();
l.setLoginIP(ip);
l.setAccount(a);
loginLogService.insert(l);
Detail_ d = new Detail_();
d.setName(detailName);
d.setLoginLog(l);
detailService.insert(d);
Account_ account = accountService.select(a.getId());
Assert.assertEquals(name, account.getRole().getName());
LoginLog_ loginLog = loginLogService.select(l.getId());
Assert.assertEquals(name, loginLog.getAccount().getRole().getName());
Role_ role = roleService.select(r.getId());
role.setName(newName);
roleService.update(role);
Account_ account2 = accountService.select(a.getId());
Assert.assertEquals(newName, account2.getRole().getName());
LoginLog_ loginLog2 = loginLogService.select(l.getId());
Assert.assertEquals(newName, loginLog2.getAccount().getRole().getName());
Detail_ detail = detailService.select(d.getId());
Assert.assertEquals(accountName, detail.getLoginLog().getAccount().getName());
Assert.assertEquals(newName, detail.getLoginLog().getAccount().getRole().getName());
// Account_ account3 = accountService.select(a.getId());
// account3.setName(newAccountName);
// accountService.update(account3);
Role_ role2 = roleService.select(r.getId());
role2.setName(newName2);
roleService.update(role2);
Detail_ detail2 = detailService.select(d.getId());
Assert.assertEquals(newName2, detail2.getLoginLog().getAccount().getRole().getName());
}
Aggregations