CheckSpec implements JsonObjectConvertible { public final boolean inherits(final @NotNull CheckSpec that) { return this.mustInherit() && !that.mustInherit() && !this.getTemplate().equals(this.getName()) && that.notUnnamed() && (that.getName().equals(this.getTemplate()) || that.getName().endsWith("/" + this.getTemplate())); }  @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 testInherits() { CheckSpec left = new CheckSpec(); CheckSpec right = new CheckSpec(); assertFalse("null left should not inherit null right", left.inherits(right)); assertFalse("null right should not inherit null left", left.isInheritedBy(right)); left.setName("left"); left.setTemplate(""); right.setName(""); assertFalse("empty left should not inherit empty right", left.inherits(right)); assertFalse("empty right should not inherit empty left", left.isInheritedBy(right)); right.setName("right"); assertFalse("empty left should not inherit empty right", left.inherits(right)); assertFalse("empty right should not inherit empty left", left.isInheritedBy(right)); left.setTemplate("notright"); assertFalse("left with other template should not inherit right", left.inherits(right)); assertFalse("right should not inherit left with other template", left.isInheritedBy(right)); left.setTemplate("right"); assertTrue("left with match template should inherit right", left.inherits(right)); assertFalse("right should not inherit left with match template", left.isInheritedBy(right)); right.setName("main/right"); assertTrue("left with suffix-matching template should inherit right", left.inherits(right)); assertFalse("right should not inherit left with suffix matching template", left.isInheritedBy(right)); }