Skip to content

Commit fa8b282

Browse files
committed
add Tags test
Signed-off-by: Christoph Rueger <[email protected]>
1 parent e379f7b commit fa8b282

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

biz.aQute.repository/test/aQute/bnd/repository/maven/provider/WorkspaceTest.java

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@
1111
import java.util.List;
1212
import java.util.Map;
1313

14+
import org.assertj.core.api.SoftAssertions;
15+
import org.assertj.core.api.junit.jupiter.SoftAssertionsExtension;
1416
import org.junit.jupiter.api.AfterEach;
1517
import org.junit.jupiter.api.BeforeEach;
1618
import org.junit.jupiter.api.Test;
19+
import org.junit.jupiter.api.extension.ExtendWith;
1720
import org.osgi.service.repository.Repository;
1821

1922
import aQute.bnd.build.Workspace;
@@ -25,6 +28,7 @@
2528
import aQute.lib.io.IO;
2629
import aQute.maven.provider.FakeNexus;
2730

31+
@ExtendWith(SoftAssertionsExtension.class)
2832
public class WorkspaceTest {
2933
@InjectTemporaryDirectory
3034
File tmp;
@@ -150,4 +154,62 @@ public void testTagDisplay() {
150154
assertEquals("foo", Tags.print(Tags.of(Tagged.EMPTY_TAGS, "foo")));
151155
assertEquals("bar,foo", Tags.print(Tags.of(Tagged.EMPTY_TAGS, "foo", "bar")));
152156
}
157+
158+
@Test
159+
public void testTags(SoftAssertions softly) {
160+
161+
softly.assertThat(Tags.of()
162+
.includesAny("resolve"))
163+
.isTrue();
164+
165+
softly.assertThat(Tags.of()
166+
.includesAny("compile"))
167+
.isTrue();
168+
169+
softly.assertThat(Tags.of("resolve")
170+
.includesAny("resolve"))
171+
.isTrue();
172+
// only in 7.2.0, will be stop working in 7.3.0
173+
softly.assertThat(Tags.of("resolve")
174+
.includesAny("compile"))
175+
.isTrue();
176+
177+
softly.assertThat(Tags.of("resolve", "compile")
178+
.includesAny("resolve"))
179+
.isTrue();
180+
181+
softly.assertThat(Tags.of("resolve", "compile")
182+
.includesAny("compile"))
183+
.isTrue();
184+
185+
softly.assertThat(Tags.of("resolve", "compile")
186+
.includesAny("compile", "resolve"))
187+
.isTrue();
188+
189+
softly.assertThat(Tags.of("resolve", "compile")
190+
.includesAny("resolve", "compile"))
191+
.isTrue();
192+
193+
softly.assertThat(Tags.of("resolve", "compile", "somethingelse")
194+
.includesAny("resolve", "compile"))
195+
.isTrue();
196+
197+
// negative
198+
softly.assertThat(Tags.of("resolve", "nocompile")
199+
.includesAny("resolve"))
200+
.isTrue();
201+
202+
softly.assertThat(Tags.of("resolve", "nocompile")
203+
.includesAny("compile"))
204+
.isFalse();
205+
206+
softly.assertThat(Tags.of("noresolve", "nocompile")
207+
.includesAny("resolve"))
208+
.isFalse();
209+
210+
softly.assertThat(Tags.of("noresolve", "nocompile")
211+
.includesAny("compile"))
212+
.isFalse();
213+
214+
}
153215
}

0 commit comments

Comments
 (0)