InsertStatementHandler implements SQLStatementHandler { public static Optional<SetAssignmentSegment> getSetAssignmentSegment(final InsertStatement insertStatement) { if (insertStatement instanceof MySQLStatement) { return ((MySQLInsertStatement) insertStatement).getSetAssignment(); } return Optional.empty(); }  static Optional<OnDuplicateKeyColumnsSegment> getOnDuplicateKeyColumnsSegment(final InsertStatement insertStatement); static Optional<SetAssignmentSegment> getSetAssignmentSegment(final InsertStatement insertStatement); static Optional<WithSegment> getWithSegment(final InsertStatement insertStatement); static Optional<OutputSegment> getOutputSegment(final InsertStatement insertStatement);  }
@Test public void assertGetSetAssignmentSegmentWithSetAssignmentSegmentForMySQL() { MySQLInsertStatement insertStatement = new MySQLInsertStatement(); insertStatement.setSetAssignment(new SetAssignmentSegment(0, 0, Collections.emptyList())); Optional<SetAssignmentSegment> setAssignmentSegment = InsertStatementHandler.getSetAssignmentSegment(insertStatement); assertTrue(setAssignmentSegment.isPresent()); }
@Test public void assertGetSetAssignmentSegmentWithoutSetAssignmentSegmentForMySQL() { MySQLInsertStatement insertStatement = new MySQLInsertStatement(); Optional<SetAssignmentSegment> setAssignmentSegment = InsertStatementHandler.getSetAssignmentSegment(insertStatement); assertFalse(setAssignmentSegment.isPresent()); }