use of mbg.test.mb3.generated.annotated.miscellaneous.mapper.EnumtestMapper 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();
}
}
use of mbg.test.mb3.generated.annotated.miscellaneous.mapper.EnumtestMapper 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();
}
}
use of mbg.test.mb3.generated.annotated.miscellaneous.mapper.EnumtestMapper 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();
}
}
use of mbg.test.mb3.generated.annotated.miscellaneous.mapper.EnumtestMapper in project generator by mybatis.
the class MiscellaneousTest method testEnumInsertMultiple.
@Test
public void testEnumInsertMultiple() {
try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
EnumtestMapper mapper = sqlSession.getMapper(EnumtestMapper.class);
List<Enumtest> records = new ArrayList<>();
Enumtest enumTest = new Enumtest();
enumTest.setId(1);
enumTest.setName(TestEnum.FRED);
records.add(enumTest);
enumTest = new Enumtest();
enumTest.setId(2);
enumTest.setName(TestEnum.BARNEY);
records.add(enumTest);
int rows = mapper.insertMultiple(records);
assertEquals(2, rows);
List<Enumtest> returnedRecords = mapper.select(SelectDSLCompleter.allRows());
assertEquals(2, returnedRecords.size());
Enumtest returnedRecord = returnedRecords.get(0);
assertEquals(1, returnedRecord.getId().intValue());
assertEquals(TestEnum.FRED, returnedRecord.getName());
}
}
use of mbg.test.mb3.generated.annotated.miscellaneous.mapper.EnumtestMapper 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());
}
}
Aggregations