### Question:
CompactSlf4jJdbcEventLogger extends Slf4jJdbcEventLogger { protected String processUnionSql(String sql) { String modified = UNION_PATTERN.matcher(sql) .replaceAll(UNION); String[] queries = modified.split(UNION); return Arrays.stream(queries) .map(this::trimSqlSelectColumns) .collect(Collectors.joining(SPACE + UNION)); } CompactSlf4jJdbcEventLogger(@Inject RuntimeProperties runtimeProperties); @Override void logQuery(String sql, ParameterBinding[] bindings); @Override void logBeginTransaction(String transactionLabel); @Override void logCommitTransaction(String transactionLabel);  }### Answer:
@Test public void compactUnion() { String processedUnionSql = logger.processUnionSql( "SELECT t0.NAME AS ec0_0, t0.F_KEY1 AS ec0_1, " + "t0.PKEY AS ec0_3 FROM COMPOUND_FK_TEST t0 INNER JOIN COMPOUND_PK_TEST " + "t1 ON (t0.F_KEY1 = t1.KEY1 AND t0.F_KEY2 = t1.KEY2) WHERE t1.NAME LIKE ?" + "UNION ALL " + "SELECT t0.NAME AS ec0_0, t0.F_KEY1 AS ec0_1," + " t0.PKEY AS ec0_3 FROM COMPOUND_FK_TEST t0 INNER JOIN COMPOUND_PK_TEST " + "t1 ON (t0.F_KEY1 = t1.KEY1 AND t0.F_KEY2 = t1.KEY2) WHERE t1.NAME LIKE ?" + "union all " + "SELECT t0.NAME AS ec0_0, t0.F_KEY1 AS ec0_1, t0.F_KEY2 AS ec0_2," + " t0.PKEY AS ec0_3 FROM COMPOUND_FK_TEST t0 INNER JOIN COMPOUND_PK_TEST " + "t1 ON (t0.F_KEY1 = t1.KEY1 AND t0.F_KEY2 = t1.KEY2) WHERE t1.NAME LIKE ?"); assertEquals(processedUnionSql, "SELECT t0.NAME AS ec0_0, t0.F_KEY1 AS ec0_1, t0.PKEY AS ec0_3 FROM COMPOUND_FK_TEST t0 " + "INNER JOIN COMPOUND_PK_TEST t1 ON (t0.F_KEY1 = t1.KEY1 AND t0.F_KEY2 = t1.KEY2) " + "WHERE t1.NAME LIKE ? UNION ALL SELECT t0.NAME AS ec0_0, t0.F_KEY1 AS ec0_1, t0.PKEY AS ec0_3 " + "FROM COMPOUND_FK_TEST t0 INNER JOIN COMPOUND_PK_TEST t1 ON (t0.F_KEY1 = t1.KEY1 AND t0.F_KEY2 = t1.KEY2) " + "WHERE t1.NAME LIKE ? UNION all SELECT (4 columns) FROM COMPOUND_FK_TEST t0 " + "INNER JOIN COMPOUND_PK_TEST t1 ON (t0.F_KEY1 = t1.KEY1 AND t0.F_KEY2 = t1.KEY2) " + "WHERE t1.NAME LIKE ?"); }