Skip to content

Commit

Permalink
Fix test picking up wrong version
Browse files Browse the repository at this point in the history
  • Loading branch information
AB-xdev committed Aug 30, 2024
1 parent e6541ee commit 9d71170
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 1.0.4
* Automatic version detection: If multiple versions are found it now uses the "highest" version

# 1.0.3
* Updated dependencies

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import java.io.InputStream;
import java.net.URL;
import java.util.Comparator;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Objects;
Expand Down Expand Up @@ -104,7 +105,10 @@ static synchronized String determineClasspathMockserverVersion()
return DEFAULT_VERSION;
}

final String foundVersion = versions.iterator().next();
// Multiple versions? -> Use highest
final String foundVersion = versions.stream()
.max(Comparator.naturalOrder())
.orElseThrow();
if(versions.size() > 1)
{
LOG.warn(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class MockServerUtilTest
void checkVersionDetection()
{
Assertions.assertEquals(
"1.2.3",
"9999.2.3",
MockServerUtils.determineClasspathMockserverVersion());
}
}
2 changes: 1 addition & 1 deletion testcontainers/src/test/resources/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Manifest-Version: 1.0

Name: Mockserver-Info
Version: 1.2.3
Version: 9999.2.3

0 comments on commit 9d71170

Please sign in to comment.