Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class MonotonicClockTest {

@Test
@DisplayName("MonotonicClock singleton instance should always return the same instance")
void testSingletonInstance() {
void singletonInstance() {
MonotonicClock clock1 = MonotonicClock.get();
MonotonicClock clock2 = MonotonicClock.get();

Expand All @@ -46,7 +46,7 @@ void testSingletonInstance() {

@Test
@DisplayName("MonotonicClock should always use UTC timezone")
void testClockTimezone() {
void clockTimezone() {
MonotonicClock clock = MonotonicClock.get();

assertEquals(ZoneOffset.UTC, clock.getZone(), "Clock should use UTC timezone");
Expand All @@ -58,7 +58,7 @@ void testClockTimezone() {

@Test
@DisplayName("MonotonicClock should maintain monotonic time progression")
void testMonotonicBehavior() throws InterruptedException {
void monotonicBehavior() throws InterruptedException {
Instant first = MonotonicClock.now();
Thread.sleep(10); // Small delay
Instant second = MonotonicClock.now();
Expand All @@ -71,7 +71,7 @@ void testMonotonicBehavior() throws InterruptedException {

@Test
@DisplayName("MonotonicClock elapsed time should increase")
void testElapsedTime() throws InterruptedException {
void elapsedTime() throws InterruptedException {
Duration initial = MonotonicClock.elapsed();
Thread.sleep(50); // Longer delay for more reliable measurement
Duration later = MonotonicClock.elapsed();
Expand All @@ -84,7 +84,7 @@ void testElapsedTime() throws InterruptedException {

@Test
@DisplayName("MonotonicClock start time should remain constant")
void testStartTime() throws InterruptedException {
void startTime() throws InterruptedException {
Instant start1 = MonotonicClock.start();
Thread.sleep(10);
Instant start2 = MonotonicClock.start();
Expand All @@ -99,7 +99,7 @@ class TimeConsistencyTests {

@Test
@DisplayName("Current time should be after start time")
void testCurrentTimeAfterStart() {
void currentTimeAfterStart() {
Instant now = MonotonicClock.now();
Instant start = MonotonicClock.start();

Expand All @@ -108,7 +108,7 @@ void testCurrentTimeAfterStart() {

@Test
@DisplayName("Elapsed time should match time difference")
void testElapsedTimeConsistency() {
void elapsedTimeConsistency() {
MonotonicClock clock = MonotonicClock.get();
Instant now = clock.instant();
Duration elapsed = clock.elapsedTime();
Expand All @@ -123,7 +123,7 @@ void testElapsedTimeConsistency() {

@Test
@DisplayName("MonotonicClock should handle rapid successive calls")
void testRapidCalls() {
void rapidCalls() {
Instant[] instants = new Instant[1000];
for (int i = 0; i < instants.length; i++) {
instants[i] = MonotonicClock.now();
Expand All @@ -139,7 +139,7 @@ void testRapidCalls() {

@Test
@DisplayName("MonotonicClock should maintain reasonable alignment with system time")
void testSystemTimeAlignment() {
void systemTimeAlignment() {
Instant monotonic = MonotonicClock.now();
Instant system = Instant.now();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
class RequestImplementationTest {

@Test
void testArtifactResolverRequestEquality() {
void artifactResolverRequestEquality() {
Session session = mock(Session.class);
ArtifactCoordinates coords1 = mock(ArtifactCoordinates.class);
ArtifactCoordinates coords2 = mock(ArtifactCoordinates.class);
Expand Down Expand Up @@ -74,7 +74,7 @@ void testArtifactResolverRequestEquality() {
}

@Test
void testRequestTraceIntegration() {
void requestTraceIntegration() {
Session session = mock(Session.class);
RequestTrace trace = new RequestTrace("test-context", null, "test-data");

Expand All @@ -86,7 +86,7 @@ void testRequestTraceIntegration() {
}

@Test
void testDependencyResolverRequestEquality() {
void dependencyResolverRequestEquality() {
Session session = mock(Session.class);

DependencyResolverRequest.DependencyResolverRequestBuilder builder = DependencyResolverRequest.builder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
class RequestTraceTest {

@Test
void testRequestTraceCreation() {
void requestTraceCreation() {
RequestTrace parentTrace = new RequestTrace("parent-context", null, "parent-data");
RequestTrace childTrace = new RequestTrace("child-context", parentTrace, "child-data");

Expand All @@ -41,7 +41,7 @@ void testRequestTraceCreation() {
}

@Test
void testRequestTraceWithParentContextInheritance() {
void requestTraceWithParentContextInheritance() {
RequestTrace parentTrace = new RequestTrace("parent-context", null, "parent-data");
RequestTrace childTrace = new RequestTrace(parentTrace, "child-data");

Expand All @@ -51,22 +51,22 @@ void testRequestTraceWithParentContextInheritance() {
}

@Test
void testPredefinedContexts() {
void predefinedContexts() {
assertEquals("plugin", RequestTrace.CONTEXT_PLUGIN);
assertEquals("project", RequestTrace.CONTEXT_PROJECT);
assertEquals("bootstrap", RequestTrace.CONTEXT_BOOTSTRAP);
}

@Test
void testNullValues() {
void nullValues() {
RequestTrace trace = new RequestTrace(null, null, null);
assertNull(trace.context());
assertNull(trace.parent());
assertNull(trace.data());
}

@Test
void testChainedTraces() {
void chainedTraces() {
RequestTrace root = new RequestTrace("root", null, "root-data");
RequestTrace level1 = new RequestTrace("level1", root, "level1-data");
RequestTrace level2 = new RequestTrace("level2", level1, "level2-data");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class SourcesTest {
Path tempDir;

@Test
void testFromPath() {
void fromPath() {
Path path = Paths.get("/tmp");
Source source = Sources.fromPath(path);

Expand All @@ -53,7 +53,7 @@ void testFromPath() {
}

@Test
void testBuildSource() {
void buildSource() {
Path path = Paths.get("/tmp");
ModelSource source = Sources.buildSource(path);

Expand All @@ -63,7 +63,7 @@ void testBuildSource() {
}

@Test
void testResolvedSource() {
void resolvedSource() {
Path path = Paths.get("/tmp");
String location = "custom-location";
ModelSource source = Sources.resolvedSource(path, location);
Expand All @@ -75,7 +75,7 @@ void testResolvedSource() {
}

@Test
void testPathSourceFunctionality() {
void pathSourceFunctionality() {
// Test basic source functionality
Path path = Paths.get("/tmp");
Sources.PathSource source = (Sources.PathSource) Sources.fromPath(path);
Expand All @@ -89,7 +89,7 @@ void testPathSourceFunctionality() {
}

@Test
void testBuildPathSourceFunctionality() {
void buildPathSourceFunctionality() {
// Test build source functionality
Path basePath = Paths.get("/tmp");
ModelSource.ModelLocator locator = mock(ModelSource.ModelLocator.class);
Expand All @@ -107,7 +107,7 @@ void testBuildPathSourceFunctionality() {
}

@Test
void testResolvedPathSourceFunctionality() {
void resolvedPathSourceFunctionality() {
// Test resolved source functionality
Path path = Paths.get("/tmp");
String location = "custom-location";
Expand All @@ -123,7 +123,7 @@ void testResolvedPathSourceFunctionality() {
}

@Test
void testStreamReading() throws IOException {
void streamReading() throws IOException {
// Test stream reading functionality
Path testFile = tempDir.resolve("test.txt");
String content = "test content";
Expand All @@ -137,7 +137,7 @@ void testStreamReading() throws IOException {
}

@Test
void testNullHandling() {
void nullHandling() {
assertThrows(NullPointerException.class, () -> Sources.fromPath(null));
assertThrows(NullPointerException.class, () -> Sources.buildSource(null));
assertThrows(NullPointerException.class, () -> Sources.resolvedSource(null, "location"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public ExtendedPluginDescriptor build() {
}

@Test
void testExtendedPluginDescriptor() {
void extendedPluginDescriptor() {
ExtendedPluginDescriptor.Builder builder = new ExtendedPluginDescriptor.Builder();
// make sure to call the subclasses' builder methods first, otherwise fluent API would not work
builder.additionalField("additional")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
class SettingsTest {

@Test
void testSetLocalRepository() {
void setLocalRepository() {
Settings s = Settings.newInstance();

s = s.withLocalRepository("xxx");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private Artifact newArtifact(String aid) {
}

@Test
void testIsSnapshot() {
void isSnapshot() {
assertFalse(ArtifactUtils.isSnapshot(null));
assertFalse(ArtifactUtils.isSnapshot(""));
assertFalse(ArtifactUtils.isSnapshot("1.2.3"));
Expand All @@ -52,7 +52,7 @@ void testIsSnapshot() {
}

@Test
void testToSnapshotVersion() {
void toSnapshotVersion() {
assertEquals("1.2.3", ArtifactUtils.toSnapshotVersion("1.2.3"));
assertEquals("1.2.3-SNAPSHOT", ArtifactUtils.toSnapshotVersion("1.2.3-SNAPSHOT"));
assertEquals("1.2.3-SNAPSHOT", ArtifactUtils.toSnapshotVersion("1.2.3-20090413.094722-2"));
Expand All @@ -63,7 +63,7 @@ void testToSnapshotVersion() {
* Tests that the ordering of the map resembles the ordering of the input collection of artifacts.
*/
@Test
void testArtifactMapByVersionlessIdOrdering() throws Exception {
void artifactMapByVersionlessIdOrdering() throws Exception {
List<Artifact> list = new ArrayList<>();
list.add(newArtifact("b"));
list.add(newArtifact("a"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void setUp() throws Exception {
}

@Test
void testGetVersionReturnsResolvedVersionOnSnapshot() {
void getVersionReturnsResolvedVersionOnSnapshot() {
assertEquals(snapshotResolvedVersion, snapshotArtifact.getVersion());

// this is FOUL!
Expand All @@ -76,24 +76,24 @@ void testGetVersionReturnsResolvedVersionOnSnapshot() {
}

@Test
void testGetDependencyConflictId() {
void getDependencyConflictId() {
assertEquals(groupId + ":" + artifactId + ":" + type + ":" + classifier, artifact.getDependencyConflictId());
}

@Test
void testGetDependencyConflictIdNullGroupId() {
void getDependencyConflictIdNullGroupId() {
artifact.setGroupId(null);
assertEquals(null + ":" + artifactId + ":" + type + ":" + classifier, artifact.getDependencyConflictId());
}

@Test
void testGetDependencyConflictIdNullClassifier() {
void getDependencyConflictIdNullClassifier() {
artifact = new DefaultArtifact(groupId, artifactId, versionRange, scope, type, null, artifactHandler);
assertEquals(groupId + ":" + artifactId + ":" + type, artifact.getDependencyConflictId());
}

@Test
void testGetDependencyConflictIdNullScope() {
void getDependencyConflictIdNullScope() {
artifact.setScope(null);
assertEquals(groupId + ":" + artifactId + ":" + type + ":" + classifier, artifact.getDependencyConflictId());
}
Expand All @@ -106,25 +106,25 @@ void testToString() {
}

@Test
void testToStringNullGroupId() {
void toStringNullGroupId() {
artifact.setGroupId(null);
assertEquals(artifactId + ":" + type + ":" + classifier + ":" + version + ":" + scope, artifact.toString());
}

@Test
void testToStringNullClassifier() {
void toStringNullClassifier() {
artifact = new DefaultArtifact(groupId, artifactId, versionRange, scope, type, null, artifactHandler);
assertEquals(groupId + ":" + artifactId + ":" + type + ":" + version + ":" + scope, artifact.toString());
}

@Test
void testToStringNullScope() {
void toStringNullScope() {
artifact.setScope(null);
assertEquals(groupId + ":" + artifactId + ":" + type + ":" + classifier + ":" + version, artifact.toString());
}

@Test
void testComparisonByVersion() {
void comparisonByVersion() {
Artifact artifact1 = new DefaultArtifact(
groupId, artifactId, VersionRange.createFromVersion("5.0"), scope, type, classifier, artifactHandler);
Artifact artifact2 = new DefaultArtifact(
Expand All @@ -135,20 +135,20 @@ void testComparisonByVersion() {

Artifact artifact = new DefaultArtifact(
groupId, artifactId, VersionRange.createFromVersion("5.0"), scope, type, classifier, artifactHandler);
assertTrue(artifact.compareTo(artifact1) == 0);
assertTrue(artifact1.compareTo(artifact) == 0);
assertEquals(0, artifact.compareTo(artifact1));
assertEquals(0, artifact1.compareTo(artifact));
}

@Test
void testNonResolvedVersionRangeConsistentlyYieldsNullVersions() throws Exception {
void nonResolvedVersionRangeConsistentlyYieldsNullVersions() throws Exception {
VersionRange vr = VersionRange.createFromVersionSpec("[1.0,2.0)");
artifact = new DefaultArtifact(groupId, artifactId, vr, scope, type, null, artifactHandler);
assertNull(artifact.getVersion());
assertNull(artifact.getBaseVersion());
}

@Test
void testMNG7780() throws Exception {
void mng7780() throws Exception {
VersionRange vr = VersionRange.createFromVersionSpec("[1.0,2.0)");
artifact = new DefaultArtifact(groupId, artifactId, vr, scope, type, null, artifactHandler);
assertNull(artifact.getVersion());
Expand All @@ -161,7 +161,7 @@ void testMNG7780() throws Exception {

@ParameterizedTest
@MethodSource("invalidMavenCoordinates")
void testIllegalCoordinatesInConstructor(String groupId, String artifactId, String version) {
void illegalCoordinatesInConstructor(String groupId, String artifactId, String version) {
assertThrows(
InvalidArtifactRTException.class,
() -> new DefaultArtifact(
Expand Down
Loading