Insert implements Operation { public static Builder into(@Nonnull String table) { Preconditions.checkNotNull(table, "table may not be null"); return new Builder(table); } private  Insert(Builder builder); @edu.umd.cs.findbugs.annotations.SuppressWarnings( value = "SQL_PREPARED_STATEMENT_GENERATED_FROM_NONCONSTANT_STRING", justification = "The point here is precisely to compose a SQL String from column names coming from the user") @Override void execute(Connection connection, BinderConfiguration configuration); int getRowCount(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); static Builder into(@Nonnull String table);  }
@Test(expected = IllegalArgumentException.class) public void rowBuilderColumnFailsWhenMapContainsUnknownColumnName() { Insert.into("A") .columns("a", "b") .row().column("c", "value of c"); }
@Test(expected = IllegalArgumentException.class) public void valuesFailsWhenMapContainsUnknownColumnName() { Map<String, Object> map1 = new LinkedHashMap<String, Object>(); map1.put("c", "value of c"); Map<String, Object> map2 = new LinkedHashMap<String, Object>(); map2.put("b", "value of b"); Insert.into("A").values(map1).values(map2); }
@Test(expected = IllegalArgumentException.class) public void endRowFailsWhenItContainsUnknownColumnNameAndColumnNamesSpecifiedByFirstRow() { Insert.into("A") .row().column("c", "value of c").end() .row().column("b", "value of b").end(); }