use of mbg.test.mb3.generated.mixed.miscellaneous.mapper.RegexrenameMapper in project generator by mybatis.
the class MiscellaneousTest method testRegexRenameInsertSelective.
@Test
public void testRegexRenameInsertSelective() {
SqlSession sqlSession = sqlSessionFactory.openSession();
try {
RegexrenameMapper mapper = sqlSession.getMapper(RegexrenameMapper.class);
Regexrename record = new Regexrename();
record.setZipCode("99999");
mapper.insertSelective(record);
Integer key = 1;
assertEquals(key, record.getId());
Regexrename returnedRecord = mapper.selectByPrimaryKey(key);
assertNull(returnedRecord.getAddress());
assertEquals(record.getId(), returnedRecord.getId());
assertNull(record.getName(), returnedRecord.getName());
assertEquals(record.getZipCode(), returnedRecord.getZipCode());
} finally {
sqlSession.close();
}
}
use of mbg.test.mb3.generated.mixed.miscellaneous.mapper.RegexrenameMapper in project generator by mybatis.
the class MiscellaneousTest method testRegexRenameInsert.
@Test
public void testRegexRenameInsert() {
try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
RegexrenameMapper mapper = sqlSession.getMapper(RegexrenameMapper.class);
Regexrename record = new Regexrename();
record.setAddress("123 Main Street");
record.setName("Fred");
record.setZipCode("99999");
mapper.insert(record);
// test generated id
assertEquals(1, record.getId());
Optional<Regexrename> returnedRecord = mapper.selectByPrimaryKey(1);
assertThat(returnedRecord).hasValueSatisfying(rr -> {
assertEquals(record.getAddress(), rr.getAddress());
assertEquals(1, rr.getId().intValue());
assertEquals(record.getName(), rr.getName());
assertEquals(record.getZipCode(), rr.getZipCode());
});
}
}
use of mbg.test.mb3.generated.mixed.miscellaneous.mapper.RegexrenameMapper in project generator by mybatis.
the class MiscellaneousTest method testRegexRenameInsertSelective.
@Test
public void testRegexRenameInsertSelective() {
try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
RegexrenameMapper mapper = sqlSession.getMapper(RegexrenameMapper.class);
Regexrename record = new Regexrename();
record.setZipCode("99999");
mapper.insertSelective(record);
assertEquals(1, record.getId());
Optional<Regexrename> returnedRecord = mapper.selectByPrimaryKey(1);
assertThat(returnedRecord).hasValueSatisfying(rr -> {
assertNull(rr.getAddress());
assertEquals(record.getId(), rr.getId());
assertNull(rr.getName());
assertEquals(record.getZipCode(), rr.getZipCode());
});
}
}
use of mbg.test.mb3.generated.mixed.miscellaneous.mapper.RegexrenameMapper in project generator by mybatis.
the class MiscellaneousTest method testRegexRenameInsert.
@Test
public void testRegexRenameInsert() {
SqlSession sqlSession = sqlSessionFactory.openSession();
try {
RegexrenameMapper mapper = sqlSession.getMapper(RegexrenameMapper.class);
Regexrename record = new Regexrename();
record.setAddress("123 Main Street");
record.setName("Fred");
record.setZipCode("99999");
mapper.insert(record);
Regexrename returnedRecord = mapper.selectByPrimaryKey(1);
assertEquals(record.getAddress(), returnedRecord.getAddress());
assertEquals(1, returnedRecord.getId().intValue());
assertEquals(record.getName(), returnedRecord.getName());
assertEquals(record.getZipCode(), returnedRecord.getZipCode());
} finally {
sqlSession.close();
}
}
use of mbg.test.mb3.generated.mixed.miscellaneous.mapper.RegexrenameMapper in project generator by mybatis.
the class MiscellaneousTest method testRegexRenameInsertSelective.
@Test
public void testRegexRenameInsertSelective() {
SqlSession sqlSession = sqlSessionFactory.openSession();
try {
RegexrenameMapper mapper = sqlSession.getMapper(RegexrenameMapper.class);
Regexrename record = new Regexrename();
record.setZipCode("99999");
mapper.insertSelective(record);
Integer key = 1;
assertEquals(key, record.getId());
Regexrename returnedRecord = mapper.selectByPrimaryKey(key);
assertNull(returnedRecord.getAddress());
assertEquals(record.getId(), returnedRecord.getId());
assertNull(record.getName(), returnedRecord.getName());
assertEquals(record.getZipCode(), returnedRecord.getZipCode());
} finally {
sqlSession.close();
}
}
Aggregations