@Test public void testBaseCompositeOver() { CheckSpec left = new CheckSpec(); CheckSpec right = new CheckSpec(); CheckSpec emptyComposite = left.baseCompositeOver(right); assertNull("getName is null", emptyComposite.getName()); assertNull("getImpl is null", emptyComposite.getImpl()); assertNull("getTemplate is null", emptyComposite.getTemplate()); assertNull("getInlineScript is null", emptyComposite.getInlineScript()); assertNull("getInlineEngine is null", emptyComposite.getInlineEngine()); assertFalse("isSkip is false", emptyComposite.isSkip()); assertEquals("getConfig is empty, not null", JsonValue.EMPTY_JSON_OBJECT, emptyComposite.getConfig()); right.setName("right_name"); right.setImpl("right_impl"); right.setTemplate("right_template"); right.setInlineScript("right_inlineScript"); right.setInlineEngine("right_inlineEngine"); right.setConfig(key("side", "right").key("onlyRight", "onlyRight").get()); right.setSkip(true); final CheckSpec allRight = left.baseCompositeOver(right); assertEquals("getName is right_name", "right_name", allRight.getName()); assertEquals("getImpl is right_impl", "right_impl", allRight.getImpl()); assertEquals("getTemplate is right_template", "right_template", allRight.getTemplate()); assertEquals("getInlineScript is right_inlineScript", "right_inlineScript", allRight.getInlineScript()); assertEquals("getInlineEngine is right_inlineEngine", "right_inlineEngine", allRight.getInlineEngine()); assertTrue("isSkip is true", allRight.isSkip()); assertEquals("getConfig side is right", "right", allRight.getConfig().getString("side")); assertEquals("getConfig onlyRight is onlyRight", "right", allRight.getConfig().getString("side")); left.setConfig(key("side", "left").key("onlyLeft", "onlyLeft").get()); final CheckSpec leftConfig = left.baseCompositeOver(right); assertEquals("getConfig side is left", "left", leftConfig.getConfig().getString("side")); assertEquals("getConfig onlyRight is onlyRight", "onlyRight", leftConfig.getConfig().getString("onlyRight")); assertEquals("getConfig onlyLeft is onlyLeft", "onlyLeft", leftConfig.getConfig().getString("onlyLeft")); left.setImpl("left_impl"); final CheckSpec leftImpl = left.baseCompositeOver(right); assertEquals("getImpl is left_impl", "left_impl", leftImpl.getImpl()); assertNull("getInlineScript is null", leftImpl.getInlineScript()); assertNull("getInlineEngine is null", leftImpl.getInlineEngine()); left.setInlineScript("left_inlineScript"); final CheckSpec leftScript = left.baseCompositeOver(right); assertNull("getImpl is left_impl", leftScript.getImpl()); assertEquals("getInlineScript is left_inlineScript", "left_inlineScript", leftScript.getInlineScript()); assertNull("getInlineEngine is null", leftScript.getInlineEngine()); left.setInlineEngine("left_inlineEngine"); final CheckSpec leftEngine = left.baseCompositeOver(right); assertNull("getImpl is left_impl", leftEngine.getImpl()); assertEquals("getInlineScript is left_inlineScript", "left_inlineScript", leftEngine.getInlineScript()); assertEquals("getInlineEngine is left_inlineEngine", "left_inlineEngine", leftEngine.getInlineEngine()); }
final CheckSpec baseCompositeOver(final @NotNull CheckSpec that) { final CheckSpec composite = copyOf(that); if (this.getInlineScript() != null) { composite.setInlineScript(this.getInlineScript()); composite.setInlineEngine(this.getInlineEngine()); composite.setImpl(null); } else if (!isEmpty(this.getImpl())) { composite.setInlineScript(null); composite.setInlineEngine(null); composite.setImpl(this.getImpl()); } composite.setConfig(JavaxJson.shallowMergeObjects(that.getConfig(), this.getConfig())); return composite; }
CheckSpec implements JsonObjectConvertible { final CheckSpec baseCompositeOver(final @NotNull CheckSpec that) { final CheckSpec composite = copyOf(that); if (this.getInlineScript() != null) { composite.setInlineScript(this.getInlineScript()); composite.setInlineEngine(this.getInlineEngine()); composite.setImpl(null); } else if (!isEmpty(this.getImpl())) { composite.setInlineScript(null); composite.setInlineEngine(null); composite.setImpl(this.getImpl()); } composite.setConfig(JavaxJson.shallowMergeObjects(that.getConfig(), this.getConfig())); return composite; } }
CheckSpec implements JsonObjectConvertible { final CheckSpec baseCompositeOver(final @NotNull CheckSpec that) { final CheckSpec composite = copyOf(that); if (this.getInlineScript() != null) { composite.setInlineScript(this.getInlineScript()); composite.setInlineEngine(this.getInlineEngine()); composite.setImpl(null); } else if (!isEmpty(this.getImpl())) { composite.setInlineScript(null); composite.setInlineEngine(null); composite.setImpl(this.getImpl()); } composite.setConfig(JavaxJson.shallowMergeObjects(that.getConfig(), this.getConfig())); return composite; }  }
CheckSpec implements JsonObjectConvertible { final CheckSpec baseCompositeOver(final @NotNull CheckSpec that) { final CheckSpec composite = copyOf(that); if (this.getInlineScript() != null) { composite.setInlineScript(this.getInlineScript()); composite.setInlineEngine(this.getInlineEngine()); composite.setImpl(null); } else if (!isEmpty(this.getImpl())) { composite.setInlineScript(null); composite.setInlineEngine(null); composite.setImpl(this.getImpl()); } composite.setConfig(JavaxJson.shallowMergeObjects(that.getConfig(), this.getConfig())); return composite; }  @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); }
CheckSpec implements JsonObjectConvertible { final CheckSpec baseCompositeOver(final @NotNull CheckSpec that) { final CheckSpec composite = copyOf(that); if (this.getInlineScript() != null) { composite.setInlineScript(this.getInlineScript()); composite.setInlineEngine(this.getInlineEngine()); composite.setImpl(null); } else if (!isEmpty(this.getImpl())) { composite.setInlineScript(null); composite.setInlineEngine(null); composite.setImpl(this.getImpl()); } composite.setConfig(JavaxJson.shallowMergeObjects(that.getConfig(), this.getConfig())); return composite; }  @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);  }