Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump JUnit 4.x to JUnit Jupiter 5 #152

Merged
merged 2 commits into from
May 19, 2024
Merged
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
6 changes: 5 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,12 @@ jar {
dependencies {
api 'org.slf4j:slf4j-api:' + slf4jVersion
testImplementation 'org.slf4j:slf4j-simple:' + slf4jVersion
testImplementation 'junit:junit:4.12'
testImplementation 'org.awaitility:awaitility:2.0.0'
testImplementation "org.hamcrest:hamcrest:2.2"
testImplementation 'com.github.ben-manes.caffeine:caffeine:2.9.0'
testImplementation platform('org.junit:junit-bom:5.10.2')
testImplementation 'org.junit.jupiter:junit-jupiter-api'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
}

task sourcesJar(type: Jar) {
Expand All @@ -96,6 +99,7 @@ test {
testLogging {
exceptionFormat = 'full'
}
useJUnitPlatform()
}

publishing {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.dataloader;

import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.HashMap;
Expand All @@ -14,8 +14,8 @@
import static java.util.Collections.singletonList;
import static org.dataloader.DataLoaderFactory.newDataLoader;
import static org.dataloader.DataLoaderFactory.newMappedDataLoader;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;

/**
* Tests related to context. DataLoaderTest is getting to big and needs refactoring
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/dataloader/DataLoaderCacheMapTest.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package org.dataloader;

import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.CompletableFuture;

import static org.dataloader.DataLoaderFactory.newDataLoader;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;

/**
* Tests for cacheMap functionality..
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/dataloader/DataLoaderIfPresentTest.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package org.dataloader;

import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;

import static org.dataloader.DataLoaderFactory.newDataLoader;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.sameInstance;
import static org.junit.Assert.assertThat;

/**
* Tests for IfPresent and IfCompleted functionality.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.dataloader;

import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.Collection;
Expand All @@ -19,10 +19,10 @@
import static org.dataloader.fixtures.TestKit.futureError;
import static org.dataloader.fixtures.TestKit.listFrom;
import static org.dataloader.impl.CompletableFutureKit.cause;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;

/**
* Much of the tests that related to {@link MappedBatchLoader} also related to
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/dataloader/DataLoaderRegistryTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

import org.dataloader.stats.SimpleStatisticsCollector;
import org.dataloader.stats.Statistics;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.util.concurrent.CompletableFuture;

import static java.util.Arrays.asList;
import static org.dataloader.DataLoaderFactory.newDataLoader;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasItems;
import static org.hamcrest.Matchers.sameInstance;
import static org.junit.Assert.assertThat;

public class DataLoaderRegistryTest {
final BatchLoader<Object, Object> identityBatchLoader = CompletableFuture::completedFuture;
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/dataloader/DataLoaderStatsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.dataloader.stats.context.IncrementCacheHitCountStatisticsContext;
import org.dataloader.stats.context.IncrementLoadCountStatisticsContext;
import org.dataloader.stats.context.IncrementLoadErrorCountStatisticsContext;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -19,9 +19,9 @@
import static java.util.Collections.singletonList;
import static java.util.concurrent.CompletableFuture.completedFuture;
import static org.dataloader.DataLoaderFactory.newDataLoader;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasSize;
import static org.junit.Assert.assertThat;

/**
* Tests related to stats. DataLoaderTest is getting to big and needs refactoring
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/org/dataloader/DataLoaderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.dataloader.fixtures.User;
import org.dataloader.fixtures.UserManager;
import org.dataloader.impl.CompletableFutureKit;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.Collection;
Expand All @@ -43,12 +43,12 @@
import static org.dataloader.DataLoaderOptions.newOptions;
import static org.dataloader.fixtures.TestKit.listFrom;
import static org.dataloader.impl.CompletableFutureKit.cause;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertThat;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;

/**
* Tests for {@link DataLoader}.
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/dataloader/DataLoaderTimeTest.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package org.dataloader;

import org.dataloader.fixtures.TestingClock;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.time.Instant;

import static org.dataloader.fixtures.TestKit.keysAsValues;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;

@SuppressWarnings("UnusedReturnValue")
public class DataLoaderTimeTest {
Expand Down
10 changes: 5 additions & 5 deletions src/test/java/org/dataloader/DataLoaderValueCacheTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.dataloader.fixtures.CaffeineValueCache;
import org.dataloader.fixtures.CustomValueCache;
import org.dataloader.impl.DataLoaderAssertionException;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -22,11 +22,11 @@
import static org.dataloader.fixtures.TestKit.snooze;
import static org.dataloader.fixtures.TestKit.sort;
import static org.dataloader.impl.CompletableFutureKit.failedFuture;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class DataLoaderValueCacheTest {

Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/dataloader/DataLoaderWithTryTest.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.dataloader;

import org.hamcrest.Matchers;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.HashMap;
Expand All @@ -12,9 +12,9 @@
import static java.util.Arrays.asList;
import static java.util.Collections.singletonList;
import static org.dataloader.DataLoaderFactory.*;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.Assert.assertThat;

public class DataLoaderWithTryTest {

Expand Down
12 changes: 6 additions & 6 deletions src/test/java/org/dataloader/TryTest.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
package org.dataloader;

import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class TryTest {

Expand All @@ -29,7 +29,7 @@ private void expectThrowable(RunThatCanThrow runnable, Class<? extends Throwable
return;
}
}
Assert.fail("Expected throwable : " + throwableClass.getName());
Assertions.fail("Expected throwable : " + throwableClass.getName());
}

@SuppressWarnings("SameParameterValue")
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/dataloader/impl/PromisedValuesImplTest.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.dataloader.impl;

import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.util.Arrays;
import java.util.Collections;
Expand All @@ -12,12 +12,12 @@
import static java.util.Arrays.asList;
import static java.util.concurrent.CompletableFuture.supplyAsync;
import static org.awaitility.Awaitility.await;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.Assert.assertThat;

public class PromisedValuesImplTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
import org.dataloader.DataLoader;
import org.dataloader.fixtures.TestKit;
import org.dataloader.fixtures.TestingClock;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.time.Duration;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class DispatchPredicateTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import org.dataloader.BatchLoader;
import org.dataloader.DataLoader;
import org.dataloader.DataLoaderRegistry;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.time.Duration;
import java.util.concurrent.CompletableFuture;
Expand All @@ -12,10 +12,9 @@
import static org.awaitility.Awaitility.await;
import static org.dataloader.DataLoaderFactory.newDataLoader;
import static org.dataloader.fixtures.TestKit.asSet;
import static org.dataloader.registries.DispatchPredicate.DISPATCH_NEVER;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;

public class ScheduledDataLoaderRegistryPredicateTest {
final BatchLoader<Object, Object> identityBatchLoader = CompletableFuture::completedFuture;
Expand Down
Loading
Loading