### Question:
AuthToLocalBuilder implements Cloneable { @Override public Object clone() throws CloneNotSupportedException { AuthToLocalBuilder copy = (AuthToLocalBuilder) super.clone(); copy.setRules = new TreeSet<>(setRules); return copy; } AuthToLocalBuilder(String defaultRealm, String additionalRealms, boolean caseInsensitiveUserSupport);  AuthToLocalBuilder(String defaultRealm, Collection<String> additionalRealms, boolean caseInsensitiveUserSupport); @Override Object clone(); AuthToLocalBuilder addRules(String authToLocalRules); AuthToLocalBuilder addRule(String principal, String localUsername); String generate(); String generate(ConcatenationType concatenationType); static final ConcatenationType DEFAULT_CONCATENATION_TYPE; }### Answer:
@Test public void testClone() throws CloneNotSupportedException { AuthToLocalBuilder builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.emptyList(), false); builder.addRule("nn/_HOST@EXAMPLE.COM", "hdfs"); builder.addRule("dn/_HOST@EXAMPLE.COM", "hdfs"); builder.addRule("jn/_HOST@EXAMPLE.COM", "hdfs"); builder.addRule("rm/_HOST@EXAMPLE.COM", "yarn"); builder.addRule("jhs/_HOST@EXAMPLE.COM", "mapred"); builder.addRule("hm/_HOST@EXAMPLE.COM", "hbase"); builder.addRule("rs/_HOST@EXAMPLE.COM", "hbase"); builder.addRule("foobar@EXAMPLE.COM", "hdfs"); AuthToLocalBuilder copy = (AuthToLocalBuilder) builder.clone(); assertNotSame(builder, copy); assertEquals(builder.generate(), copy.generate()); builder.addRule("user@EXAMPLE.COM", "hdfs"); assertTrue(!copy.generate().equals(builder.generate())); }