diff --git a/doc/src/test/java/com/mastercard/test/flow/doc/ModuleDiagramTest.java b/doc/src/test/java/com/mastercard/test/flow/doc/ModuleDiagramTest.java index 25b4cf0d50..4cc4c0a88c 100644 --- a/doc/src/test/java/com/mastercard/test/flow/doc/ModuleDiagramTest.java +++ b/doc/src/test/java/com/mastercard/test/flow/doc/ModuleDiagramTest.java @@ -34,10 +34,20 @@ class ModuleDiagramTest { "com.mastercard.test.flow:aggregator", "com.mastercard.test.flow:doc" ).collect( toSet() ); + /** + * Maps from the groupID to the scope of links that we're interested in within + * that group. + */ private static final Map> SCOPES; static { Map> m = new HashMap<>(); + // For the framework we want to show *what* will be included transitively if you + // consume an artifact. We've got some test-scope dependencies in here to + // avoid excessive mocking, but they just cloud the diagram. m.put( "com.mastercard.test.flow", Stream.of( "compile" ).collect( toSet() ) ); + // For the example service it's important to show *how* the framework + // dependencies are consumed - e.g. assert and validation are always test scope, + // the model doesn't make it into the distributable artifacts, etc m.put( "com.mastercard.test.flow.example", Stream.of( "compile", "test" ).collect( toSet() ) ); SCOPES = Collections.unmodifiableMap( m ); } @@ -133,8 +143,6 @@ protected Link( String fromGroup, String fromArtifact, String type, String toGro this.type = type; this.toGroup = toGroup; this.toArtifact = toArtifact; - - System.out.println( this + " " + intraGroup() ); } public boolean intraGroup() { diff --git a/validation/validation-core/src/main/java/com/mastercard/test/flow/validation/check/ModelTaggingCheck.java b/validation/validation-core/src/main/java/com/mastercard/test/flow/validation/check/ModelTaggingCheck.java index f06c2b3e4a..fd1c09de39 100644 --- a/validation/validation-core/src/main/java/com/mastercard/test/flow/validation/check/ModelTaggingCheck.java +++ b/validation/validation-core/src/main/java/com/mastercard/test/flow/validation/check/ModelTaggingCheck.java @@ -71,8 +71,8 @@ private List buildChecks( Model model, List checks ) { .collect( Collectors.toCollection( TreeSet::new ) ); modelUnionTags.removeAll( modelIntersectionTags ); - String expected = formatCopypasta( modelUnionTags, modelIntersectionTags ); - String actual = formatCopypasta( flowUnionTags, flowIntersectionTags ); + String expected = formatCopypasta( flowUnionTags, flowIntersectionTags ); + String actual = formatCopypasta( modelUnionTags, modelIntersectionTags ); if( !expected.equals( actual ) ) { return new Violation( this, "Inaccurate tagging", expected, actual ); @@ -97,9 +97,8 @@ private static String formatCopypasta( Set union, Set intersecti sb.append( ")\n .union(" ); sb.append( union.stream() .collect( joining( QUOTE_COMMA_QUOTE, QUOTE, QUOTE ) ) ); - sb.append( ")" ); } - sb.append( ";" ); + sb.append( ");" ); return sb.toString(); } diff --git a/validation/validation-core/src/test/java/com/mastercard/test/flow/validation/check/ModelTaggingCheckTest.java b/validation/validation-core/src/test/java/com/mastercard/test/flow/validation/check/ModelTaggingCheckTest.java index 9bf75e15d8..56d8f00090 100644 --- a/validation/validation-core/src/test/java/com/mastercard/test/flow/validation/check/ModelTaggingCheckTest.java +++ b/validation/validation-core/src/test/java/com/mastercard/test/flow/validation/check/ModelTaggingCheckTest.java @@ -61,14 +61,30 @@ void accurate() { */ @Test void violation() { - test( leaf( "leaf", + test( leaf( "empty model tags", + new TaggedGroup(), + "a,b,c" ), + " details: Inaccurate tagging\n" + + " expected: new TaggedGroup(\"a\", \"b\", \"c\");\n" + + " actual: new TaggedGroup();\n" + + "offenders: " ); + + test( leaf( "empty flow tags", + new TaggedGroup( "a", "b", "c" ).union( "d" ) ), + " details: Inaccurate tagging\n" + + " expected: new TaggedGroup();\n" + + " actual: new TaggedGroup(\"a\", \"b\", \"c\")\n" + + " .union(\"d\");\n" + + "offenders: " ); + + test( leaf( "mismatch", new TaggedGroup( "a", "b", "c" ).union( "d" ), "a,b,c", "b,c,d" ), " details: Inaccurate tagging\n" - + " expected: new TaggedGroup(\"a\", \"b\", \"c\")\n" - + " .union(\"d\");\n" - + " actual: new TaggedGroup(\"b\", \"c\")\n" + + " expected: new TaggedGroup(\"b\", \"c\")\n" + " .union(\"a\", \"d\");\n" + + " actual: new TaggedGroup(\"a\", \"b\", \"c\")\n" + + " .union(\"d\");\n" + "offenders: " ); } @@ -83,14 +99,14 @@ void recursiveViolation() { leaf( "right", new TaggedGroup( "b", "c" ), "b,c,d" ) ), "left : pass", " details: Inaccurate tagging\n" - + " expected: new TaggedGroup(\"b\", \"c\";\n" - + " actual: new TaggedGroup(\"b\", \"c\", \"d\";\n" + + " expected: new TaggedGroup(\"b\", \"c\", \"d\");\n" + + " actual: new TaggedGroup(\"b\", \"c\");\n" + "offenders: ", " details: Inaccurate tagging\n" + " expected: new TaggedGroup(\"b\")\n" - + " .union(\"a\", \"c\", \"x\");\n" - + " actual: new TaggedGroup(\"b\")\n" + " .union(\"a\", \"c\", \"d\");\n" + + " actual: new TaggedGroup(\"b\")\n" + + " .union(\"a\", \"c\", \"x\");\n" + "offenders: " ); }