|
50 | 50 | import static org.hamcrest.Matchers.arrayContaining; |
51 | 51 | import static org.hamcrest.Matchers.arrayWithSize; |
52 | 52 | import static org.hamcrest.Matchers.emptyArray; |
| 53 | +import static org.hamcrest.Matchers.equalTo; |
53 | 54 | import static org.hamcrest.Matchers.hasItem; |
54 | 55 | import static org.hamcrest.Matchers.hasToString; |
55 | 56 | import static org.hamcrest.Matchers.is; |
@@ -344,4 +345,34 @@ void testPredicate() { |
344 | 345 | assertThat(noSnapshots.getVersions(true), arrayWithSize(15)); |
345 | 346 | assertThat(noSnapshots.getCurrentVersion(), nullValue()); |
346 | 347 | } |
| 348 | + |
| 349 | + @Test |
| 350 | + void testRestrictionForUnchangedSegmentIfActualVersionNullAndUpperRestrictionNull() throws InvalidSegmentException { |
| 351 | + ArtifactVersions versions = new ArtifactVersions( |
| 352 | + new DefaultArtifact("default-group", "dummy-api", "(,2)", "foo", "bar", "jar", null), |
| 353 | + Arrays.asList(versions("1.0.0"))); |
| 354 | + assertThat( |
| 355 | + versions.restrictionForUnchangedSegment(null, Optional.of(MAJOR), false), |
| 356 | + is(equalTo(new Restriction(null, false, null, false)))); |
| 357 | + } |
| 358 | + |
| 359 | + @Test |
| 360 | + void testRestrictionForSelectedSegmentIfLowerBoundNull() throws InvalidSegmentException { |
| 361 | + ArtifactVersions versions = new ArtifactVersions( |
| 362 | + new DefaultArtifact("default-group", "dummy-api", "(,)", "foo", "bar", "jar", null), |
| 363 | + Arrays.asList(versions("1.0.0"))); |
| 364 | + assertThat( |
| 365 | + versions.restrictionForSelectedSegment(null, Optional.of(MAJOR)), |
| 366 | + is(equalTo(new Restriction(null, false, null, false)))); |
| 367 | + } |
| 368 | + |
| 369 | + @Test |
| 370 | + void testRestrictionForIgnoreScopeLowerBoundNull() throws InvalidSegmentException { |
| 371 | + ArtifactVersions versions = new ArtifactVersions( |
| 372 | + new DefaultArtifact("default-group", "dummy-api", "(,)", "foo", "bar", "jar", null), |
| 373 | + Arrays.asList(versions("1.0.0"))); |
| 374 | + assertThat( |
| 375 | + versions.restrictionForIgnoreScope(null, Optional.of(MAJOR)), |
| 376 | + is(equalTo(new Restriction(null, false, null, false)))); |
| 377 | + } |
347 | 378 | } |
0 commit comments