CCJSqlParserManager parserManager = new CCJSqlParserManager();
@Test
public void testRegularInsert() throws JSQLParserException {
String statement = "INSERT INTO mytable (col1, col2, col3) VALUES (?, 'sadfsd', 234)";
Insert insert = (Insert) parserManager.parse(new StringReader(statement));
assertEquals("mytable", insert.getTable().getName());
assertEquals(3, insert.getColumns().size());
assertEquals("col1", ((Column) insert.getColumns().get(0)).getColumnName());
assertEquals("col2", ((Column) insert.getColumns().get(1)).getColumnName());
assertEquals("col3", ((Column) insert.getColumns().get(2)).getColumnName());
assertEquals(3, ((ExpressionList) insert.getItemsList()).getExpressions().size());
assertTrue(((ExpressionList) insert.getItemsList()).getExpressions().get(0) instanceof JdbcParameter);
assertEquals("sadfsd",
((StringValue) ((ExpressionList) insert.getItemsList()).getExpressions().get(1)).getValue());
assertEquals(234, ((LongValue) ((ExpressionList) insert.getItemsList()).getExpressions().get(2)).getValue());
assertEquals(statement, "" + insert);
statement = "INSERT INTO myschema.mytable VALUES (?, ?, 2.3)";
insert = (Insert) parserManager.parse(new StringReader(statement));
assertEquals("myschema.mytable", insert.getTable().getFullyQualifiedName());
assertEquals(3, ((ExpressionList) insert.getItemsList()).getExpressions().size());
assertTrue(((ExpressionList) insert.getItemsList()).getExpressions().get(0) instanceof JdbcParameter);
assertEquals(2.3, ((DoubleValue) ((ExpressionList) insert.getItemsList()).getExpressions().get(2)).getValue(),
0.0);
assertEquals(statement, "" + insert);
}