### Question:
BuiltinIdentityIdGenerator extends AbstractIdGenerator implements IdentityIdGenerator { @Override public Long generatePreInsert(IdGenerationConfig config) { IdProvider idProvider = config.getIdProvider(); if (idProvider.isAvailable()) { return idProvider.get(); } return null; }  @Override boolean supportsBatch(IdGenerationConfig config); @Override boolean includesIdentityColumn(IdGenerationConfig config); @Override boolean supportsAutoGeneratedKeys(IdGenerationConfig config); @Override Long generatePreInsert(IdGenerationConfig config); @Override Long generatePostInsert(IdGenerationConfig config, Statement statement); @Override GenerationType getGenerationType();  }### Answer:
@Test public void test_identityReservationSql() { MockConfig config = new MockConfig(); config.setDialect(new PostgresDialect()); MockResultSet resultSet = config.dataSource.connection.preparedStatement.resultSet; resultSet.rows.add(new RowData(11L)); resultSet.rows.add(new RowData(12L)); resultSet.rows.add(new RowData(13L)); EntityType<IdGeneratedEmp> entityType = _IdGeneratedEmp.getSingletonInternal(); BuiltinIdentityIdGenerator identityIdGenerator = new BuiltinIdentityIdGenerator(); IdGenerationConfig idGenerationConfig = new IdGenerationConfig(config, entityType, new ReservedIdProvider(config, entityType, 3)); Long value = identityIdGenerator.generatePreInsert(idGenerationConfig); assertEquals(new Long(11), value); assertEquals( "select nextval(pg_catalog.pg_get_serial_sequence('\"CATA\".\"EMP\"', 'id')) from generate_series(1, 3)", config.dataSource.connection.preparedStatement.sql); value = identityIdGenerator.generatePreInsert(idGenerationConfig); assertEquals(new Long(12), value); value = identityIdGenerator.generatePreInsert(idGenerationConfig); assertEquals(new Long(13), value); try { identityIdGenerator.generatePreInsert(idGenerationConfig); fail(); } catch (IllegalStateException e) { System.out.println(e.getMessage()); } }