Skip to content

Commit

Permalink
Use varargs for localRepositoryTail
Browse files Browse the repository at this point in the history
  • Loading branch information
aloubyansky committed Sep 20, 2024
1 parent 78ff380 commit 4f02189
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public T setLocalRepository(String localRepo) {
* @return this instance
*/
@SuppressWarnings("unchecked")
public T setLocalRepositoryTail(String[] localRepoTail) {
public T setLocalRepositoryTail(String... localRepoTail) {
this.localRepoTail = localRepoTail;
return (T) this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void testValidTailViaSystemProp() throws Exception {
public void testValidTailViaConfig() throws Exception {
final BootstrapMavenContext mvn = bootstrapMavenContextForProject("workspace-with-local-repo-tail",
BootstrapMavenContext.config()
.setLocalRepositoryTail(new String[] { M2_LOCAL_1 }));
.setLocalRepositoryTail(M2_LOCAL_1));

assertNotNull(resolveOrgAcmeFooJar001(mvn));
}
Expand All @@ -83,11 +83,11 @@ public void testValidTailViaConfig() throws Exception {
public void testValidTailResolutionOrder() throws Exception {
final BootstrapMavenContext mvnLocal1first = bootstrapMavenContextForProject("workspace-with-local-repo-tail",
BootstrapMavenContext.config()
.setLocalRepositoryTail(new String[] { M2_LOCAL_1, M2_LOCAL_2 }));
.setLocalRepositoryTail(M2_LOCAL_1, M2_LOCAL_2));

final BootstrapMavenContext mvnLocal2first = bootstrapMavenContextForProject("workspace-with-local-repo-tail",
BootstrapMavenContext.config()
.setLocalRepositoryTail(new String[] { M2_LOCAL_2, M2_LOCAL_1 }));
.setLocalRepositoryTail(M2_LOCAL_2, M2_LOCAL_1));

assertEquals(resolveOrgAcmeFooJar001(mvnLocal1first).getFile().getAbsolutePath(),
Paths.get(M2_LOCAL_1, "org", "acme", "foo", "0.0.1", "foo-0.0.1.jar").toAbsolutePath().toString());
Expand All @@ -99,7 +99,7 @@ public void testValidTailResolutionOrder() throws Exception {
public void testValidTailMultiplicity() throws Exception {
final BootstrapMavenContext mvn = bootstrapMavenContextForProject("workspace-with-local-repo-tail",
BootstrapMavenContext.config()
.setLocalRepositoryTail(new String[] { M2_LOCAL_1, M2_LOCAL_2 }));
.setLocalRepositoryTail(M2_LOCAL_1, M2_LOCAL_2));

final Artifact foo = resolveOrgAcmeFooJar001(mvn);
assertNotNull(foo);
Expand All @@ -119,7 +119,7 @@ public void testValidTailLocalCheckingForAvailabilityViaConfig() throws Exceptio
final BootstrapMavenContext mvn = bootstrapMavenContextForProject("workspace-with-local-repo-tail",
BootstrapMavenContext.config()
.setLocalRepositoryTailIgnoreAvailability(false)
.setLocalRepositoryTail(new String[] { M2_LOCAL_1 }));
.setLocalRepositoryTail(M2_LOCAL_1));

assertNotNull(resolveOrgAcmeFooJar001(mvn));
}
Expand All @@ -129,7 +129,7 @@ public void testValidTailFromRemoteCheckingForAvailabilityViaConfig() throws Exc
final BootstrapMavenContext mvn = bootstrapMavenContextForProject("workspace-with-local-repo-tail",
BootstrapMavenContext.config()
.setLocalRepositoryTailIgnoreAvailability(false)
.setLocalRepositoryTail(new String[] { M2_FROM_REMOTE }));
.setLocalRepositoryTail(M2_FROM_REMOTE));

assertThrowsExactly(BootstrapMavenException.class, () -> resolveOrgAcmeFooJar001(mvn));
}
Expand All @@ -139,7 +139,7 @@ public void testValidTailFromRemoteCheckingForAvailabilityViaSystemProp() throws
setSystemProp("maven.repo.local.tail.ignoreAvailability", "false");
final BootstrapMavenContext mvn = bootstrapMavenContextForProject("workspace-with-local-repo-tail",
BootstrapMavenContext.config()
.setLocalRepositoryTail(new String[] { M2_FROM_REMOTE }));
.setLocalRepositoryTail(M2_FROM_REMOTE));

assertThrowsExactly(BootstrapMavenException.class, () -> resolveOrgAcmeFooJar001(mvn));
}
Expand All @@ -149,7 +149,7 @@ public void testValidTailFromRemoteIgnoringAvailabilityViaSystemPropEmpty() thro
setSystemProp("maven.repo.local.tail.ignoreAvailability", ""); // will become `true`
final BootstrapMavenContext mvn = bootstrapMavenContextForProject("workspace-with-local-repo-tail",
BootstrapMavenContext.config()
.setLocalRepositoryTail(new String[] { M2_FROM_REMOTE }));
.setLocalRepositoryTail(M2_FROM_REMOTE));

assertNotNull(resolveOrgAcmeFooJar001(mvn));
}
Expand All @@ -159,7 +159,7 @@ public void testValidTailFromRemoteIgnoringAvailabilityViaSystemPropBlank() thro
setSystemProp("maven.repo.local.tail.ignoreAvailability", " "); // will become `true`
final BootstrapMavenContext mvn = bootstrapMavenContextForProject("workspace-with-local-repo-tail",
BootstrapMavenContext.config()
.setLocalRepositoryTail(new String[] { M2_FROM_REMOTE }));
.setLocalRepositoryTail(M2_FROM_REMOTE));

assertNotNull(resolveOrgAcmeFooJar001(mvn));
}
Expand All @@ -169,7 +169,7 @@ public void testValidTailFromRemoteIgnoringAvailabilityViaSystemPropTruthy() thr
setSystemProp("maven.repo.local.tail.ignoreAvailability", "fals"); // will become `true`
final BootstrapMavenContext mvn = bootstrapMavenContextForProject("workspace-with-local-repo-tail",
BootstrapMavenContext.config()
.setLocalRepositoryTail(new String[] { M2_FROM_REMOTE }));
.setLocalRepositoryTail(M2_FROM_REMOTE));

assertNotNull(resolveOrgAcmeFooJar001(mvn));
}
Expand All @@ -179,7 +179,7 @@ public void testValidTailLocalIgnoringAvailabilityViaConfig() throws Exception {
final BootstrapMavenContext mvn = bootstrapMavenContextForProject("workspace-with-local-repo-tail",
BootstrapMavenContext.config()
.setLocalRepositoryTailIgnoreAvailability(true)
.setLocalRepositoryTail(new String[] { M2_LOCAL_1 }));
.setLocalRepositoryTail(M2_LOCAL_1));

assertNotNull(resolveOrgAcmeFooJar001(mvn));
}
Expand All @@ -189,7 +189,7 @@ public void testValidTailFromRemoteIgnoringAvailabilityViaConfig() throws Except
final BootstrapMavenContext mvn = bootstrapMavenContextForProject("workspace-with-local-repo-tail",
BootstrapMavenContext.config()
.setLocalRepositoryTailIgnoreAvailability(true)
.setLocalRepositoryTail(new String[] { M2_FROM_REMOTE }));
.setLocalRepositoryTail(M2_FROM_REMOTE));

assertNotNull(resolveOrgAcmeFooJar001(mvn));
}
Expand Down

0 comments on commit 4f02189

Please sign in to comment.