### Question:
MySQLQueryFactory extends AbstractSQLQueryFactory<MySQLQuery<?>> { public SQLInsertClause insertOnDuplicateKeyUpdate(RelationalPath<?> entity, String clause) { SQLInsertClause insert = insert(entity); insert.addFlag(Position.END, " on duplicate key update " + clause); return insert; } MySQLQueryFactory(Configuration configuration, Provider<Connection> connection);  MySQLQueryFactory(Provider<Connection> connection);  MySQLQueryFactory(SQLTemplates templates, Provider<Connection> connection); SQLInsertClause insertIgnore(RelationalPath<?> entity); SQLInsertClause insertOnDuplicateKeyUpdate(RelationalPath<?> entity, String clause); SQLInsertClause insertOnDuplicateKeyUpdate(RelationalPath<?> entity, Expression<?> clause); SQLInsertClause insertOnDuplicateKeyUpdate(RelationalPath<?> entity, Expression<?>... clauses); @Override MySQLQuery<?> query(); MySQLReplaceClause replace(RelationalPath<?> entity); @Override MySQLQuery<T> select(Expression<T> expr); @Override MySQLQuery<Tuple> select(Expression<?>... exprs); @Override MySQLQuery<T> selectDistinct(Expression<T> expr); @Override MySQLQuery<Tuple> selectDistinct(Expression<?>... exprs); @Override MySQLQuery<Integer> selectZero(); @Override MySQLQuery<Integer> selectOne(); @Override MySQLQuery<T> selectFrom(RelationalPath<T> expr);  }### Answer:
@Test public void insertOnDuplicateKeyUpdate() { SQLInsertClause clause = queryFactory.insertOnDuplicateKeyUpdate(QSurvey.survey, "c = c+1"); assertEquals("insert into SURVEY\nvalues () on duplicate key update c = c+1", clause.toString()); }
@Test public void insertOnDuplicateKeyUpdate2() { SQLInsertClause clause = queryFactory.insertOnDuplicateKeyUpdate(QSurvey.survey, QSurvey.survey.id.eq(2)); assertEquals("insert into SURVEY\nvalues () on duplicate key update SURVEY.ID = ?", clause.toString()); }
@Test public void insertOnDuplicateKeyUpdate_multiple() { SQLInsertClause clause = queryFactory.insertOnDuplicateKeyUpdate(QSurvey.survey, SQLExpressions.set(QSurvey.survey.id, 2), SQLExpressions.set(QSurvey.survey.name, "B")); assertEquals("insert into SURVEY\n" + "values () on duplicate key update SURVEY.ID = ?, SURVEY.NAME = ?", clause.toString()); }
@Test public void insertOnDuplicateKeyUpdate_values() { SQLInsertClause clause = queryFactory.insertOnDuplicateKeyUpdate(QSurvey.survey, SQLExpressions.set(QSurvey.survey.name, QSurvey.survey.name)); assertEquals("insert into SURVEY\n" + "values () on duplicate key update SURVEY.NAME = values(SURVEY.NAME)", clause.toString()); }
@Test public void insertOnDuplicateKeyUpdate_null() { SQLInsertClause clause = queryFactory.insertOnDuplicateKeyUpdate(QSurvey.survey, SQLExpressions.set(QSurvey.survey.name, (String) null)); assertEquals("insert into SURVEY\n" + "values () on duplicate key update SURVEY.NAME = null", clause.toString()); }