|
1 | 1 | /*
|
2 |
| - * Copyright 2012-2019 the original author or authors. |
| 2 | + * Copyright 2012-2020 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
@@ -138,6 +138,48 @@ void allMissingClassesWithAllClassesMissingPerformsAdd() {
|
138 | 138 | assertThat(this.classNode.getAnnotations(new ClassNode(Grab.class))).hasSize(1);
|
139 | 139 | }
|
140 | 140 |
|
| 141 | + @Test |
| 142 | + void allResourcesPresentWithAllResourcesPresentPerformsAdd() { |
| 143 | + this.dependencyCustomizer.ifAllResourcesPresent("dependency-customizer-tests/resource1.txt", |
| 144 | + "dependency-customizer-tests/resource2.txt").add("spring-boot-starter-logging"); |
| 145 | + assertThat(this.classNode.getAnnotations(new ClassNode(Grab.class))).hasSize(1); |
| 146 | + } |
| 147 | + |
| 148 | + @Test |
| 149 | + void allResourcesPresentWithSomeResourcesPresentDoesNotPerformAdd() { |
| 150 | + this.dependencyCustomizer.ifAllResourcesPresent("dependency-customizer-tests/resource1.txt", |
| 151 | + "dependency-customizer-tests/does-not-exist.txt").add("spring-boot-starter-logging"); |
| 152 | + assertThat(this.classNode.getAnnotations(new ClassNode(Grab.class))).isEmpty(); |
| 153 | + } |
| 154 | + |
| 155 | + @Test |
| 156 | + void allResourcesPresentWithNoResourcesPresentDoesNotPerformAdd() { |
| 157 | + this.dependencyCustomizer.ifAllResourcesPresent("dependency-customizer-tests/does-not-exist", |
| 158 | + "dependency-customizer-tests/does-not-exist-either.txt").add("spring-boot-starter-logging"); |
| 159 | + assertThat(this.classNode.getAnnotations(new ClassNode(Grab.class))).isEmpty(); |
| 160 | + } |
| 161 | + |
| 162 | + @Test |
| 163 | + void anyResourcesPresentWithAllResourcesPresentPerformsAdd() { |
| 164 | + this.dependencyCustomizer.ifAnyResourcesPresent("dependency-customizer-tests/resource1.txt", |
| 165 | + "dependency-customizer-tests/resource2.txt").add("spring-boot-starter-logging"); |
| 166 | + assertThat(this.classNode.getAnnotations(new ClassNode(Grab.class))).hasSize(1); |
| 167 | + } |
| 168 | + |
| 169 | + @Test |
| 170 | + void anyResourcesPresentWithSomeResourcesPresentPerforms() { |
| 171 | + this.dependencyCustomizer.ifAnyResourcesPresent("dependency-customizer-tests/resource1.txt", |
| 172 | + "dependency-customizer-tests/does-not-exist.txt").add("spring-boot-starter-logging"); |
| 173 | + assertThat(this.classNode.getAnnotations(new ClassNode(Grab.class))).hasSize(1); |
| 174 | + } |
| 175 | + |
| 176 | + @Test |
| 177 | + void anyResourcesPresentWithNoResourcesPresentDoesNotPerformAdd() { |
| 178 | + this.dependencyCustomizer.ifAnyResourcesPresent("dependency-customizer-tests/does-not-exist", |
| 179 | + "dependency-customizer-tests/does-not-exist-either.txt").add("spring-boot-starter-logging"); |
| 180 | + assertThat(this.classNode.getAnnotations(new ClassNode(Grab.class))).isEmpty(); |
| 181 | + } |
| 182 | + |
141 | 183 | private void assertGrabAnnotation(AnnotationNode annotationNode, String group, String module, String version,
|
142 | 184 | String classifier, String type, boolean transitive) {
|
143 | 185 | assertThat(getMemberValue(annotationNode, "group")).isEqualTo(group);
|
|
0 commit comments