### Question:
EnumPartition extends BasePartition implements JdbcFragmentMetadata { @Override public String toSqlConstraint(String quoteString, DbProduct dbProduct) { if (quoteString == null) { throw new RuntimeException("Quote string cannot be null"); } StringBuilder sb = new StringBuilder(); String quotedColumn = quoteString + column + quoteString; if (excluded == null) { sb.append(quotedColumn).append(" = '").append(value).append("'"); } else { sb.append("( ") .append(Stream.of(excluded) .map(excludedValue -> quotedColumn + " <> '" + excludedValue + "'") .collect(Collectors.joining(" AND ")) ).append(" )"); } return sb.toString(); } EnumPartition(String column, String value);  EnumPartition(String column, String[] excluded); @Override String toSqlConstraint(String quoteString, DbProduct dbProduct); String getValue(); String[] getExcluded();  }### Answer:
@Test public void testNormal() { EnumPartition partition = new EnumPartition(COL_RAW, "enum1"); String constraint = partition.toSqlConstraint(QUOTE, dbProduct); assertEquals("\"col\" = 'enum1'", constraint); }
@Test public void testExcluded1() { EnumPartition partition = new EnumPartition(COL_RAW, new String[]{"enum1"}); String constraint = partition.toSqlConstraint(QUOTE, dbProduct); assertEquals("( \"col\" <> 'enum1' )", constraint); }
@Test public void testExcluded2() { EnumPartition partition = new EnumPartition(COL_RAW, new String[]{"enum1", "enum2"}); String constraint = partition.toSqlConstraint(QUOTE, dbProduct); assertEquals("( \"col\" <> 'enum1' AND \"col\" <> 'enum2' )", constraint); }
@Test public void testExcluded3() { EnumPartition partition = new EnumPartition(COL_RAW, new String[]{"enum1", "enum2", "enum3"}); String constraint = partition.toSqlConstraint(QUOTE, dbProduct); assertEquals("( \"col\" <> 'enum1' AND \"col\" <> 'enum2' AND \"col\" <> 'enum3' )", constraint); }
@Test public void testInvalidNullQuoteString() { thrown.expect(RuntimeException.class); EnumPartition partition = new EnumPartition(COL_RAW, "enum1"); partition.toSqlConstraint(null, dbProduct); }