@Test
public void testCopyOf() {

    final CheckSpec.JsonKeys keys = CheckSpec.keys();
    final JsonObject specJson = obj()
            .key(keys.name(), keys.name())
            .key(keys.impl(), keys.impl())
            .key(keys.inlineScript(), keys.inlineScript())
            .key(keys.inlineEngine(), keys.inlineEngine())
            .key(keys.config(), key("foo", "bar"))
            .key(keys.template(), keys.template())
            .key(keys.skip(), true)
            .get();
    final CheckSpec spec = CheckSpec.fromJson(specJson);
    assertEquals("copy should equal copied", spec, CheckSpec.copyOf(spec));
    assertEquals("immutable copy should equal copied", spec, CheckSpec.immutableCopyOf(spec));
    assertEquals("copied should equal copy", CheckSpec.copyOf(spec), spec);
    assertEquals("copied should equal immutable copy", CheckSpec.immutableCopyOf(spec), spec);
    final Set<CheckSpec> specSet = new HashSet<>();
    specSet.add(spec);
    specSet.add(CheckSpec.copyOf(spec));
    assertEquals("hashSet should still only have one.", 1, specSet.size());
    specSet.add(CheckSpec.immutableCopyOf(spec));
    assertEquals("hashSet should still only have one.", 1, specSet.size());
    final CheckSpec diffed = CheckSpec.copyOf(spec);
    diffed.setName("eman");
    specSet.add(diffed);
    assertEquals("hashSet should now have two.", 2, specSet.size());
}