Search in sources :

Example 1 with TestEnum

use of mbg.test.mb3.common.TestEnum in project generator by mybatis.

the class MiscellaneousTest method testEnum.

@Test
public void testEnum() {
    SqlSession sqlSession = sqlSessionFactory.openSession();
    try {
        EnumtestMapper mapper = sqlSession.getMapper(EnumtestMapper.class);
        Enumtest enumTest = new Enumtest();
        enumTest.setId(1);
        enumTest.setName(TestEnum.FRED);
        int rows = mapper.insert(enumTest);
        assertEquals(1, rows);
        List<Enumtest> returnedRecords = mapper.selectByExample(null);
        assertEquals(1, returnedRecords.size());
        Enumtest returnedRecord = returnedRecords.get(0);
        assertEquals(1, returnedRecord.getId().intValue());
        assertEquals(TestEnum.FRED, returnedRecord.getName());
    } finally {
        sqlSession.close();
    }
}
Also used : EnumtestMapper(mbg.test.mb3.generated.annotated.miscellaneous.mapper.EnumtestMapper) SqlSession(org.apache.ibatis.session.SqlSession) Enumtest(mbg.test.mb3.generated.annotated.miscellaneous.model.Enumtest) Test(org.junit.jupiter.api.Test)

Example 2 with TestEnum

use of mbg.test.mb3.common.TestEnum in project generator by mybatis.

the class MiscellaneousTest method testEnum.

@Test
public void testEnum() {
    SqlSession sqlSession = sqlSessionFactory.openSession();
    try {
        EnumtestMapper mapper = sqlSession.getMapper(EnumtestMapper.class);
        Enumtest enumTest = new Enumtest();
        enumTest.setId(1);
        enumTest.setName(TestEnum.FRED);
        int rows = mapper.insert(enumTest);
        assertEquals(1, rows);
        List<Enumtest> returnedRecords = mapper.selectByExample(null);
        assertEquals(1, returnedRecords.size());
        Enumtest returnedRecord = returnedRecords.get(0);
        assertEquals(1, returnedRecord.getId().intValue());
        assertEquals(TestEnum.FRED, returnedRecord.getName());
    } finally {
        sqlSession.close();
    }
}
Also used : EnumtestMapper(mbg.test.mb3.generated.mixed.miscellaneous.mapper.EnumtestMapper) SqlSession(org.apache.ibatis.session.SqlSession) Enumtest(mbg.test.mb3.generated.mixed.miscellaneous.model.Enumtest) Test(org.junit.jupiter.api.Test)

Example 3 with TestEnum

use of mbg.test.mb3.common.TestEnum in project generator by mybatis.

the class MiscellaneousTest method testEnum.

@Test
public void testEnum() {
    SqlSession sqlSession = sqlSessionFactory.openSession();
    try {
        EnumtestMapper mapper = sqlSession.getMapper(EnumtestMapper.class);
        Enumtest enumTest = new Enumtest();
        enumTest.setId(1);
        enumTest.setName(TestEnum.FRED);
        int rows = mapper.insert(enumTest);
        assertEquals(1, rows);
        List<Enumtest> returnedRecords = mapper.selectByExample(null);
        assertEquals(1, returnedRecords.size());
        Enumtest returnedRecord = returnedRecords.get(0);
        assertEquals(1, returnedRecord.getId().intValue());
        assertEquals(TestEnum.FRED, returnedRecord.getName());
    } finally {
        sqlSession.close();
    }
}
Also used : EnumtestMapper(mbg.test.mb3.generated.miscellaneous.mapper.EnumtestMapper) SqlSession(org.apache.ibatis.session.SqlSession) Enumtest(mbg.test.mb3.generated.miscellaneous.model.Enumtest) Test(org.junit.jupiter.api.Test)

Example 4 with TestEnum

use of mbg.test.mb3.common.TestEnum in project generator by mybatis.

the class MiscellaneousTest method testEnum.

@Test
public void testEnum() {
    try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
        EnumtestMapper mapper = sqlSession.getMapper(EnumtestMapper.class);
        Enumtest enumTest = new Enumtest();
        enumTest.setId(1);
        enumTest.setName(TestEnum.FRED);
        int rows = mapper.insert(enumTest);
        assertEquals(1, rows);
        List<Enumtest> returnedRecords = mapper.select(SelectDSLCompleter.allRows());
        assertEquals(1, returnedRecords.size());
        Enumtest returnedRecord = returnedRecords.get(0);
        assertEquals(1, returnedRecord.getId().intValue());
        assertEquals(TestEnum.FRED, returnedRecord.getName());
    }
}
Also used : EnumtestMapper(mbg.test.mb3.generated.dsql.miscellaneous.mapper.EnumtestMapper) SqlSession(org.apache.ibatis.session.SqlSession) Enumtest(mbg.test.mb3.generated.dsql.miscellaneous.model.Enumtest) Test(org.junit.jupiter.api.Test)

Aggregations

SqlSession (org.apache.ibatis.session.SqlSession)4 Test (org.junit.jupiter.api.Test)4 EnumtestMapper (mbg.test.mb3.generated.annotated.miscellaneous.mapper.EnumtestMapper)1 Enumtest (mbg.test.mb3.generated.annotated.miscellaneous.model.Enumtest)1 EnumtestMapper (mbg.test.mb3.generated.dsql.miscellaneous.mapper.EnumtestMapper)1 Enumtest (mbg.test.mb3.generated.dsql.miscellaneous.model.Enumtest)1 EnumtestMapper (mbg.test.mb3.generated.miscellaneous.mapper.EnumtestMapper)1 Enumtest (mbg.test.mb3.generated.miscellaneous.model.Enumtest)1 EnumtestMapper (mbg.test.mb3.generated.mixed.miscellaneous.mapper.EnumtestMapper)1 Enumtest (mbg.test.mb3.generated.mixed.miscellaneous.model.Enumtest)1