InsertQueryBuilder { InsertQuery<T> build() { buildSQL(); builder.addMethod(applyMethod(entityClass, paramFields)); Function<T, Object[]> paramBuilder = builder.build(); return new InsertQuery<>(sql, generatedColumn, paramBuilder); } InsertQueryBuilder(Class<T> entityClass);   }
@Test void assignedId() { InsertQueryBuilder<AssignedIdEntity> builder = new InsertQueryBuilder<>(AssignedIdEntity.class); InsertQuery<AssignedIdEntity> query = builder.build(); assertThat(builder.builder.sourceCode()).isEqualTo(ClasspathResources.text("db-test/insert-query-param-builder-assigned-id.java")); assertThat(query.sql).isEqualTo("INSERT INTO assigned_id_entity (id, string_field, int_field, big_decimal_field, date_field) VALUES (?, ?, ?, ?, ?)"); assertThat(query.generatedColumn).isNull(); }
@Test void autoIncrementId() { InsertQueryBuilder<AutoIncrementIdEntity> builder = new InsertQueryBuilder<>(AutoIncrementIdEntity.class); InsertQuery<AutoIncrementIdEntity> query = builder.build(); assertThat(builder.builder.sourceCode()).isEqualTo(ClasspathResources.text("db-test/insert-query-param-builder-auto-increment-id.java")); assertThat(query.sql).isEqualTo("INSERT INTO auto_increment_id_entity (string_field, double_field, enum_field, date_time_field, zoned_date_time_field) VALUES (?, ?, ?, ?, ?)"); assertThat(query.generatedColumn).isEqualTo("id"); }