Skip to content

Commit

Permalink
Distinguish @Archtag meta-annotation tests in ArchUnitTestEngineTest
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-shuy committed Jan 13, 2020
1 parent bf465c8 commit 8c642aa
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -485,12 +485,12 @@ void meta_tag_of_test_classes() {
TestDescriptor descriptor = testEngine.discover(discoveryRequest, engineId);

TestDescriptor testClass = getOnlyElement(descriptor.getChildren());
assertThat(testClass.getTags()).containsOnly(TestTag.create("tag-one"), TestTag.create("tag-two"));
assertThat(testClass.getTags()).containsOnly(TestTag.create("meta-tag-one"), TestTag.create("meta-tag-two"));

Set<? extends TestDescriptor> concreteRules = getAllLeafs(testClass);
assertThat(concreteRules).as("concrete rules").hasSize(3);
concreteRules.forEach(concreteRule ->
assertThat(concreteRule.getTags()).containsOnly(TestTag.create("tag-one"), TestTag.create("tag-two"))
assertThat(concreteRule.getTags()).containsOnly(TestTag.create("meta-tag-one"), TestTag.create("meta-tag-two"))
);
}

Expand All @@ -501,12 +501,12 @@ void meta_tags_of_test_classes() {
TestDescriptor descriptor = testEngine.discover(discoveryRequest, engineId);

TestDescriptor testClass = getOnlyElement(descriptor.getChildren());
assertThat(testClass.getTags()).containsOnly(TestTag.create("tag-one"), TestTag.create("tag-two"));
assertThat(testClass.getTags()).containsOnly(TestTag.create("meta-tags-one"), TestTag.create("meta-tags-two"));

Set<? extends TestDescriptor> concreteRules = getAllLeafs(testClass);
assertThat(concreteRules).as("concrete rules").hasSize(3);
concreteRules.forEach(concreteRule ->
assertThat(concreteRule.getTags()).containsOnly(TestTag.create("tag-one"), TestTag.create("tag-two"))
assertThat(concreteRule.getTags()).containsOnly(TestTag.create("meta-tags-one"), TestTag.create("meta-tags-two"))
);
}

Expand All @@ -521,14 +521,14 @@ void tags_of_rule_fields() {
void meta_tag_of_rule_fields() {
TestDescriptor testField = getOnlyChildWithDescriptorContaining(FIELD_WITH_META_TAG_NAME, TestFieldWithMetaTag.class);

assertThat(testField.getTags()).containsOnly(TestTag.create("field-tag-one"), TestTag.create("field-tag-two"));
assertThat(testField.getTags()).containsOnly(TestTag.create("field-meta-tag-one"), TestTag.create("field-meta-tag-two"));
}

@Test
void meta_tags_of_rule_fields() {
TestDescriptor testField = getOnlyChildWithDescriptorContaining(FIELD_WITH_META_TAGS_NAME, TestFieldWithMetaTags.class);

assertThat(testField.getTags()).containsOnly(TestTag.create("field-tag-one"), TestTag.create("field-tag-two"));
assertThat(testField.getTags()).containsOnly(TestTag.create("field-meta-tags-one"), TestTag.create("field-meta-tags-two"));
}

@Test
Expand All @@ -542,14 +542,14 @@ void tags_of_rule_methods() {
void meta_tag_of_rule_methods() {
TestDescriptor testMethod = getOnlyChildWithDescriptorContaining(METHOD_WITH_META_TAG_NAME, TestMethodWithMetaTag.class);

assertThat(testMethod.getTags()).containsOnly(TestTag.create("method-tag-one"), TestTag.create("method-tag-two"));
assertThat(testMethod.getTags()).containsOnly(TestTag.create("method-meta-tag-one"), TestTag.create("method-meta-tag-two"));
}

@Test
void meta_tags_of_rule_methods() {
TestDescriptor testMethod = getOnlyChildWithDescriptorContaining(METHOD_WITH_META_TAGS_NAME, TestMethodWithMetaTags.class);

assertThat(testMethod.getTags()).containsOnly(TestTag.create("method-tag-one"), TestTag.create("method-tag-two"));
assertThat(testMethod.getTags()).containsOnly(TestTag.create("method-meta-tags-one"), TestTag.create("method-meta-tags-two"));
}

@Test
Expand Down Expand Up @@ -599,45 +599,45 @@ void complex_meta_tags() {
descriptor.accept(d -> tagsById.put(d.getUniqueId(), d.getTags()));

assertThat(getTagsForIdEndingIn(ComplexMetaTags.class.getSimpleName(), tagsById))
.containsOnly(TestTag.create("library-tag"));
.containsOnly(TestTag.create("library-meta-tag"));

assertThat(getTagsForIdEndingIn(TestClassWithMetaTag.class.getSimpleName(), tagsById))
.containsOnly(
TestTag.create("library-tag"),
TestTag.create("rules-tag"),
TestTag.create("tag-one"),
TestTag.create("tag-two"));
TestTag.create("library-meta-tag"),
TestTag.create("rules-meta-tag"),
TestTag.create("meta-tag-one"),
TestTag.create("meta-tag-two"));

assertThat(getTagsForIdEndingIn(TestClassWithMetaTags.class.getSimpleName(), tagsById))
.containsOnly(
TestTag.create("library-tag"),
TestTag.create("rules-tag"),
TestTag.create("tag-one"),
TestTag.create("tag-two"));
TestTag.create("library-meta-tag"),
TestTag.create("rules-meta-tag"),
TestTag.create("meta-tags-one"),
TestTag.create("meta-tags-two"));

assertThat(getTagsForIdEndingIn(TestClassWithMetaTag.FIELD_RULE_NAME, tagsById))
.containsOnly(
TestTag.create("library-tag"),
TestTag.create("rules-tag"),
TestTag.create("tag-one"),
TestTag.create("tag-two"));
TestTag.create("library-meta-tag"),
TestTag.create("rules-meta-tag"),
TestTag.create("meta-tag-one"),
TestTag.create("meta-tag-two"));

assertThat(getTagsForIdEndingIn(TestClassWithMetaTags.FIELD_RULE_NAME, tagsById))
.containsOnly(
TestTag.create("library-tag"),
TestTag.create("rules-tag"),
TestTag.create("tag-one"),
TestTag.create("tag-two"));
TestTag.create("library-meta-tag"),
TestTag.create("rules-meta-tag"),
TestTag.create("meta-tags-one"),
TestTag.create("meta-tags-two"));

assertThat(getTagsForIdEndingIn(ComplexMetaTags.FIELD_RULE_NAME, tagsById))
.containsOnly(
TestTag.create("library-tag"),
TestTag.create("field-tag"));
TestTag.create("library-meta-tag"),
TestTag.create("field-meta-tag"));

assertThat(getTagsForIdEndingIn(ComplexMetaTags.METHOD_RULE_NAME, tagsById))
.containsOnly(
TestTag.create("library-tag"),
TestTag.create("method-tag"));
TestTag.create("library-meta-tag"),
TestTag.create("method-meta-tag"));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,28 +40,28 @@ static void method_rule(JavaClasses classes) {
@Inherited
@Retention(RUNTIME)
@Target({TYPE, METHOD, FIELD})
@ArchTag("library-tag")
@ArchTag("library-meta-tag")
@interface LibraryTag {
}

@Inherited
@Retention(RUNTIME)
@Target({TYPE, METHOD, FIELD})
@ArchTag("rules-tag")
@ArchTag("rules-meta-tag")
@interface RulesTag {
}

@Inherited
@Retention(RUNTIME)
@Target({TYPE, METHOD, FIELD})
@ArchTag("field-tag")
@ArchTag("field-meta-tag")
@interface FieldTag {
}

@Inherited
@Retention(RUNTIME)
@Target({TYPE, METHOD, FIELD})
@ArchTag("method-tag")
@ArchTag("method-meta-tag")
@interface MethodTag {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ static void method_in_class_with_meta_tag(JavaClasses classes) {
@Inherited
@Retention(RUNTIME)
@Target({TYPE, METHOD, FIELD})
@ArchTag("tag-one")
@ArchTag("tag-two")
@ArchTag("meta-tag-one")
@ArchTag("meta-tag-two")
@interface MetaTag {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ static void method_in_class_with_meta_tags(JavaClasses classes) {
@Retention(RUNTIME)
@Target({TYPE, METHOD, FIELD})
@ArchTags({
@ArchTag("tag-one"),
@ArchTag("tag-two"),
@ArchTag("meta-tags-one"),
@ArchTag("meta-tags-two"),
})
@interface MetaTags {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public class TestFieldWithMetaTag {
@Inherited
@Retention(RUNTIME)
@Target({TYPE, METHOD, FIELD})
@ArchTag("field-tag-one")
@ArchTag("field-tag-two")
@ArchTag("field-meta-tag-one")
@ArchTag("field-meta-tag-two")
private @interface MetaTag {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public class TestFieldWithMetaTags {
@Retention(RUNTIME)
@Target({TYPE, METHOD, FIELD})
@ArchTags({
@ArchTag("field-tag-one"),
@ArchTag("field-tag-two"),
@ArchTag("field-meta-tags-one"),
@ArchTag("field-meta-tags-two"),
})
private @interface MetaTags {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ static void method_with_meta_tag(JavaClasses classes) {
@Inherited
@Retention(RUNTIME)
@Target({TYPE, METHOD, FIELD})
@ArchTag("method-tag-one")
@ArchTag("method-tag-two")
@ArchTag("method-meta-tag-one")
@ArchTag("method-meta-tag-two")
private @interface MetaTag {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ static void method_with_meta_tags(JavaClasses classes) {
@Retention(RUNTIME)
@Target({TYPE, METHOD, FIELD})
@ArchTags({
@ArchTag("method-tag-one"),
@ArchTag("method-tag-two"),
@ArchTag("method-meta-tags-one"),
@ArchTag("method-meta-tags-two"),
})
private @interface MetaTags {
}
Expand Down

0 comments on commit 8c642aa

Please sign in to comment.