@Test void testGenerateWithTestDatabaseMetadataWhenMultipleColumns() { List<DatabaseTableColumnMetadata> multipleDatabaseTableColumnMetadata = List.of(buildDatabaseTableColumnMetadata(TEST_COLUMN_NAME, TEST_COLUMN_TYPE), buildDatabaseTableColumnMetadata(TEST_COLUMN_NAME_2, TEST_COLUMN_TYPE)); DatabaseTableData databaseTableMetadata = buildDatabaseTableData(multipleDatabaseTableColumnMetadata, TEST_TABLE_NAME); String resultQuery = databaseTableInsertQueryGenerator.generate(databaseTableMetadata); String expectedQuery = "INSERT INTO testTableName(testColumnName, testColumnName2) VALUES (?, ?)"; Assertions.assertEquals(expectedQuery, resultQuery); }
public String generate(DatabaseTableData tableMetadata) { StringBuilder result = new StringBuilder(); return result.append("INSERT INTO ") .append(tableMetadata.getTableName()) .append(OPEN_BRACKET) .append(generateInsertStatementTableColums(tableMetadata.getTableColumnsMetadata())) .append(CLOSING_BRACKET) .append(" VALUES ") .append(OPEN_BRACKET) .append(generateInsertStatementParameters(tableMetadata.getTableColumnsMetadata() .size())) .append(CLOSING_BRACKET) .toString(); }
DatabaseTableInsertQueryGenerator { public String generate(DatabaseTableData tableMetadata) { StringBuilder result = new StringBuilder(); return result.append("INSERT INTO ") .append(tableMetadata.getTableName()) .append(OPEN_BRACKET) .append(generateInsertStatementTableColums(tableMetadata.getTableColumnsMetadata())) .append(CLOSING_BRACKET) .append(" VALUES ") .append(OPEN_BRACKET) .append(generateInsertStatementParameters(tableMetadata.getTableColumnsMetadata() .size())) .append(CLOSING_BRACKET) .toString(); } }
DatabaseTableInsertQueryGenerator { public String generate(DatabaseTableData tableMetadata) { StringBuilder result = new StringBuilder(); return result.append("INSERT INTO ") .append(tableMetadata.getTableName()) .append(OPEN_BRACKET) .append(generateInsertStatementTableColums(tableMetadata.getTableColumnsMetadata())) .append(CLOSING_BRACKET) .append(" VALUES ") .append(OPEN_BRACKET) .append(generateInsertStatementParameters(tableMetadata.getTableColumnsMetadata() .size())) .append(CLOSING_BRACKET) .toString(); }  }
DatabaseTableInsertQueryGenerator { public String generate(DatabaseTableData tableMetadata) { StringBuilder result = new StringBuilder(); return result.append("INSERT INTO ") .append(tableMetadata.getTableName()) .append(OPEN_BRACKET) .append(generateInsertStatementTableColums(tableMetadata.getTableColumnsMetadata())) .append(CLOSING_BRACKET) .append(" VALUES ") .append(OPEN_BRACKET) .append(generateInsertStatementParameters(tableMetadata.getTableColumnsMetadata() .size())) .append(CLOSING_BRACKET) .toString(); }  String generate(DatabaseTableData tableMetadata); }
DatabaseTableInsertQueryGenerator { public String generate(DatabaseTableData tableMetadata) { StringBuilder result = new StringBuilder(); return result.append("INSERT INTO ") .append(tableMetadata.getTableName()) .append(OPEN_BRACKET) .append(generateInsertStatementTableColums(tableMetadata.getTableColumnsMetadata())) .append(CLOSING_BRACKET) .append(" VALUES ") .append(OPEN_BRACKET) .append(generateInsertStatementParameters(tableMetadata.getTableColumnsMetadata() .size())) .append(CLOSING_BRACKET) .toString(); }  String generate(DatabaseTableData tableMetadata);  }