Search in sources :

Example 1 with ProjRatio

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

the class GroupTest method test1.

@Test
@DatabaseSetups({ @DatabaseSetup(connection = "dataSource1", type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/groupTest/test1.datasource.xml") })
@ExpectedDatabases({ @ExpectedDatabase(connection = "dataSource1", override = false, assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/groupTest/test1.datasource.result.xml") })
@DatabaseTearDowns({ @DatabaseTearDown(connection = "dataSource1", type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/groupTest/test1.datasource.xml") })
public void test1() {
    ProjRatio projRatio = projRatioMapper.select(1);
    System.out.println("::" + JSONObject.toJSONString(projRatio));
    EmpScore2 empScore = empScore2Mapper.select(1L);
    System.out.println("::" + JSONObject.toJSONString(empScore));
    Assert.assertEquals(1, empScore.getProjRatio().getId().intValue());
    EmpScore2 e = new EmpScore2();
    e.setId(3L);
    List<EmpScore2> empScore2List = empScore2Mapper.selectAll(e);
    Assert.assertEquals(1, empScore2List.size());
    Assert.assertEquals(3, empScore2List.get(0).getProjRatio().getId().intValue());
    ProjRatio p = new ProjRatio();
    p.setId(2L);
    e.setProjRatio(p);
    List<EmpScore2> empScore2List2 = empScore2Mapper.selectAll(e);
    Assert.assertEquals(1, empScore2List2.size());
    Assert.assertEquals(2, empScore2List2.get(0).getProjRatio().getId().intValue());
    EmpScore2 e2 = new EmpScore2();
    e2.setId(3L);
    int c = empScore2Mapper.count(e2);
    Assert.assertEquals(4, c);
    EmpScore2 e3 = new EmpScore2();
    e3.setStaffId("111");
    int c2 = empScore2Mapper.count(e3);
    Assert.assertEquals(2, c2);
}
Also used : ProjRatio(indi.mybatis.flying.pojo.ProjRatio) EmpScore2(indi.mybatis.flying.pojo.EmpScore2) DatabaseSetups(com.github.springtestdbunit.annotation.DatabaseSetups) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) ExpectedDatabases(com.github.springtestdbunit.annotation.ExpectedDatabases) DatabaseTearDowns(com.github.springtestdbunit.annotation.DatabaseTearDowns)

Aggregations

DatabaseSetups (com.github.springtestdbunit.annotation.DatabaseSetups)1 DatabaseTearDowns (com.github.springtestdbunit.annotation.DatabaseTearDowns)1 ExpectedDatabases (com.github.springtestdbunit.annotation.ExpectedDatabases)1 EmpScore2 (indi.mybatis.flying.pojo.EmpScore2)1 ProjRatio (indi.mybatis.flying.pojo.ProjRatio)1 Test (org.junit.Test)1 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1