### Question:
AutoInsertQuery extends AutoModifyQuery<ENTITY> implements InsertQuery { @Override public void prepare() { super.prepare(); assertNotNull(method, entityType, entity); executable = true; preInsert(); prepareSpecialPropertyTypes(); prepareOptions(); prepareTargetPropertyType(); prepareIdValue(); prepareVersionValue(); prepareSql(); assertNotNull(sql); } AutoInsertQuery(EntityType<ENTITY> entityType); @Override void prepare(); @Override void generateId(Statement statement); @Override void complete(); void setNullExcluded(boolean nullExcluded);  }### Answer:
@Test public void testPrepare() { Emp emp = new Emp(); emp.setId(10); emp.setName("aaa"); AutoInsertQuery<Emp> query = new AutoInsertQuery<>(_Emp.getSingletonInternal()); query.setMethod(method); query.setConfig(runtimeConfig); query.setEntity(emp); query.setCallerClassName("aaa"); query.setCallerMethodName("bbb"); query.setSqlLogType(SqlLogType.FORMATTED); query.prepare(); assertNotNull(((InsertQuery) query).getSql()); }
@Test public void testOption_default() { Emp emp = new Emp(); emp.setId(10); emp.setName("aaa"); AutoInsertQuery<Emp> query = new AutoInsertQuery<>(_Emp.getSingletonInternal()); query.setMethod(method); query.setConfig(runtimeConfig); query.setEntity(emp); query.setCallerClassName("aaa"); query.setCallerMethodName("bbb"); query.setSqlLogType(SqlLogType.FORMATTED); query.prepare(); PreparedSql sql = query.getSql(); assertEquals( "insert into EMP (ID, NAME, SALARY, VERSION) values (?, ?, ?, ?)", sql.getRawSql()); List<InParameter<?>> parameters = sql.getParameters(); assertEquals(4, parameters.size()); assertEquals(10, parameters.get(0).getWrapper().get()); assertEquals("aaa", parameters.get(1).getWrapper().get()); assertNull(parameters.get(2).getWrapper().get()); assertEquals(1, parameters.get(3).getWrapper().get()); }
@Test public void testOption_include() { Emp emp = new Emp(); emp.setId(10); emp.setName("aaa"); emp.setSalary(new BigDecimal(200)); AutoInsertQuery<Emp> query = new AutoInsertQuery<>(_Emp.getSingletonInternal()); query.setMethod(method); query.setConfig(runtimeConfig); query.setEntity(emp); query.setIncludedPropertyNames("name"); query.setCallerClassName("aaa"); query.setCallerMethodName("bbb"); query.setSqlLogType(SqlLogType.FORMATTED); query.prepare(); PreparedSql sql = query.getSql(); assertEquals("insert into EMP (ID, NAME, VERSION) values (?, ?, ?)", sql.getRawSql()); List<InParameter<?>> parameters = sql.getParameters(); assertEquals(3, parameters.size()); assertEquals(10, parameters.get(0).getWrapper().get()); assertEquals("aaa", parameters.get(1).getWrapper().get()); assertEquals(1, parameters.get(2).getWrapper().get()); }
@Test public void testOption_exclude() { Emp emp = new Emp(); emp.setId(10); emp.setName("aaa"); emp.setSalary(new BigDecimal(200)); AutoInsertQuery<Emp> query = new AutoInsertQuery<>(_Emp.getSingletonInternal()); query.setMethod(method); query.setConfig(runtimeConfig); query.setEntity(emp); query.setExcludedPropertyNames("name"); query.setCallerClassName("aaa"); query.setCallerMethodName("bbb"); query.setSqlLogType(SqlLogType.FORMATTED); query.prepare(); PreparedSql sql = query.getSql(); assertEquals("insert into EMP (ID, SALARY, VERSION) values (?, ?, ?)", sql.getRawSql()); List<InParameter<?>> parameters = sql.getParameters(); assertEquals(3, parameters.size()); assertEquals(10, parameters.get(0).getWrapper().get()); assertEquals(new BigDecimal(200), parameters.get(1).getWrapper().get()); assertEquals(1, parameters.get(2).getWrapper().get()); }