CheckSpec implements JsonObjectConvertible { public final boolean overrides(final @NotNull CheckSpec that) { return this.notUnnamed() && that.notUnnamed() && !this.mustInherit() && !that.mustInherit() && (that.getName().equals(this.getName()) || (this.isAbstract() && that.getName().endsWith("/" + this.getName()))); }  @NotNull static CheckSpec.JsonKeys keys(); String getImpl(); void setImpl(final String impl); String getInlineScript(); void setInlineScript(final String inlineScript); String getInlineEngine(); void setInlineEngine(final String inlineEngine); final boolean isAbstract(); final boolean notAbstract(); String getName(); void setName(final String name); String getTemplate(); void setTemplate(final String template); boolean isSkip(); void setSkip(final boolean skip); final boolean notSkipped(); JsonObject getConfig(); void setConfig(final JsonObject config); final boolean overrides(final @NotNull CheckSpec that); final boolean isOverriddenBy(final @NotNull CheckSpec that); final CheckSpec overlay(final @NotNull CheckSpec that); final boolean inherits(final @NotNull CheckSpec that); final boolean isInheritedBy(final @NotNull CheckSpec that); final CheckSpec inherit(final @NotNull CheckSpec that); static CheckSpec fromJson(final @NotNull JsonObject json); @Override final JsonObject toJson(); @Override String toString(); @Override boolean equals(final Object o); @Override int hashCode(); static CheckSpec copyOf(final @NotNull CheckSpec original); static ImmutableSpec immutableCopyOf(final @NotNull CheckSpec original);  }
@Test public void testOverrides() { CheckSpec left = new CheckSpec(); CheckSpec right = new CheckSpec(); assertFalse("left should not override right if either is unnamed", left.overrides(right)); assertFalse("right should not override left if either is unnamed", left.isOverriddenBy(right)); left.setName("base"); right.setName("base"); left.setTemplate("inheriting"); assertFalse("left and right should not override each other when left must inherit", left.overrides(right)); assertFalse("right and left should not override each other when left must inherit", left.isOverriddenBy(right)); left.setTemplate(null); right.setTemplate("inheriting"); assertFalse("left and right should not override each other when right must inherit", left.overrides(right)); assertFalse("right and left should not override each other when right must inherit", left.isOverriddenBy(right)); right.setTemplate(null); assertTrue("left and right should override each other with same name", left.overrides(right)); assertTrue("right and left should override each other with same name", left.isOverriddenBy(right)); left.setName("main/base"); assertFalse("left should not override right if left name is not same or suffix of right name", left.overrides(right)); assertTrue("right should override left if right is suffix of left name", left.isOverriddenBy(right)); right.setName("core/base"); assertFalse("right should not override left if right name is not same or suffix of left name", left.isOverriddenBy(right)); }