### Question:
AutoBatchInsertQuery extends AutoBatchModifyQuery<ENTITY> implements BatchInsertQuery { @Override public void prepare() { super.prepare(); assertNotNull(method, entities, sqls); int size = entities.size(); if (size == 0) { return; } executable = true; executionSkipCause = null; currentEntity = entities.get(0); preInsert(); prepareIdAndVersionPropertyTypes(); prepareOptions(); prepareTargetPropertyTypes(); prepareIdValue(); prepareVersionValue(); prepareSql(); entities.set(0, currentEntity); for (ListIterator<ENTITY> it = entities.listIterator(1); it.hasNext(); ) { currentEntity = it.next(); preInsert(); prepareIdValue(); prepareVersionValue(); prepareSql(); it.set(currentEntity); } currentEntity = null; assertEquals(entities.size(), sqls.size()); } AutoBatchInsertQuery(EntityType<ENTITY> entityType); @Override void prepare(); @Override boolean isBatchSupported(); @Override void generateId(Statement statement, int index); @Override void complete();  }### Answer:
@Test public void testPrepare() { Emp emp1 = new Emp(); emp1.setId(10); emp1.setName("aaa"); Emp emp2 = new Emp(); emp2.setId(20); emp2.setName("bbb"); AutoBatchInsertQuery<Emp> query = new AutoBatchInsertQuery<>(_Emp.getSingletonInternal()); query.setMethod(method); query.setConfig(runtimeConfig); query.setCallerClassName("aaa"); query.setCallerMethodName("bbb"); query.setEntities(Arrays.asList(emp1, emp2)); query.setSqlLogType(SqlLogType.FORMATTED); query.prepare(); assertTrue(((BatchInsertQuery) query).isBatchSupported()); assertEquals(2, ((BatchInsertQuery) query).getSqls().size()); }
@Test public void testOption_default() { Emp emp1 = new Emp(); emp1.setId(10); emp1.setName("aaa"); Emp emp2 = new Emp(); emp2.setId(20); emp2.setSalary(new BigDecimal(2000)); emp2.setVersion(10); AutoBatchInsertQuery<Emp> query = new AutoBatchInsertQuery<>(_Emp.getSingletonInternal()); query.setMethod(method); query.setConfig(runtimeConfig); query.setCallerClassName("aaa"); query.setCallerMethodName("bbb"); query.setEntities(Arrays.asList(emp1, emp2)); query.setSqlLogType(SqlLogType.FORMATTED); query.prepare(); PreparedSql sql = query.getSqls().get(0); 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()); sql = query.getSqls().get(1); assertEquals( "insert into EMP (ID, NAME, SALARY, VERSION) values (?, ?, ?, ?)", sql.getRawSql()); parameters = sql.getParameters(); assertEquals(4, parameters.size()); assertEquals(20, parameters.get(0).getWrapper().get()); assertNull(parameters.get(1).getWrapper().get()); assertEquals(new BigDecimal(2000), parameters.get(2).getWrapper().get()); assertEquals(10, parameters.get(3).getWrapper().get()); }