mirror of
https://github.com/vacp2p/linea-besu.git
synced 2026-01-08 23:17:54 -05:00
services - migrate to junit 5 (#5613)
* services to junit5 * removed some junit4 engine imports * updated some plugins test since these extend from testutil KV storage * one more form of EPL v2 Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com> --------- Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
This commit is contained in:
@@ -33,8 +33,6 @@ dependencies {
|
||||
implementation 'com.google.guava:guava'
|
||||
|
||||
testImplementation project(':testutil')
|
||||
testImplementation 'junit:junit'
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter'
|
||||
testImplementation 'org.assertj:assertj-core'
|
||||
|
||||
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine'
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ import org.hyperledger.besu.kvstore.AbstractKeyValueStorageTest;
|
||||
import org.hyperledger.besu.plugin.services.storage.KeyValueStorage;
|
||||
import org.hyperledger.besu.plugin.services.storage.KeyValueStorageTransaction;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class LimitedInMemoryKeyValueStorageTest extends AbstractKeyValueStorageTest {
|
||||
|
||||
|
||||
@@ -37,11 +37,9 @@ dependencies {
|
||||
implementation 'io.opentelemetry:opentelemetry-api'
|
||||
implementation 'com.google.guava:guava'
|
||||
|
||||
testImplementation 'junit:junit'
|
||||
testImplementation 'org.assertj:assertj-core'
|
||||
testImplementation 'org.awaitility:awaitility'
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter'
|
||||
testImplementation 'org.mockito:mockito-core'
|
||||
|
||||
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine'
|
||||
testImplementation 'org.mockito:mockito-junit-jupiter'
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import static org.mockito.Mockito.when;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class AsyncOperationProcessorTest {
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.hyperledger.besu.plugin.services.metrics.Counter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class BatchingReadPipeTest {
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import static org.hyperledger.besu.metrics.noop.NoOpMetricsSystem.NO_OP_COUNTER;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class CompleterStageTest {
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import static org.mockito.Mockito.when;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class FlatMapProcessorTest {
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.hyperledger.besu.metrics.noop.NoOpMetricsSystem.NO_OP_COUNTER;
|
||||
|
||||
import com.google.common.collect.Iterators;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class IteratorSourceStageTest {
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class MapProcessorTest {
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.hyperledger.besu.plugin.services.metrics.Counter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class PipeTest {
|
||||
private final Counter inputCounter = mock(Counter.class);
|
||||
|
||||
@@ -51,8 +51,8 @@ import java.util.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class PipelineBuilderTest {
|
||||
|
||||
@@ -66,7 +66,7 @@ public class PipelineBuilderTest {
|
||||
|
||||
private final ExecutorService executorService = Executors.newCachedThreadPool(THREAD_FACTORY);
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void afterClass() throws Exception {
|
||||
executorService.shutdownNow();
|
||||
if (!executorService.awaitTermination(10, SECONDS)) {
|
||||
|
||||
@@ -16,7 +16,7 @@ package org.hyperledger.besu.services.pipeline;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.hyperledger.besu.metrics.noop.NoOpMetricsSystem.NO_OP_COUNTER;
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.Mockito.lenient;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||
@@ -24,13 +24,13 @@ import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class ProcessingStageTest {
|
||||
|
||||
private final Pipe<String> inputPipe =
|
||||
@@ -40,10 +40,11 @@ public class ProcessingStageTest {
|
||||
@Mock private Processor<String, String> singleStep;
|
||||
private ProcessingStage<String, String> stage;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
stage = new ProcessingStage<>("name", inputPipe, outputPipe, singleStep);
|
||||
doAnswer(
|
||||
lenient()
|
||||
.doAnswer(
|
||||
invocation -> {
|
||||
outputPipe.put(inputPipe.get().toLowerCase(Locale.UK));
|
||||
return 1;
|
||||
|
||||
@@ -18,7 +18,7 @@ import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.verifyNoInteractions;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class SharedWritePipeTest {
|
||||
|
||||
|
||||
@@ -40,9 +40,6 @@ dependencies {
|
||||
implementation 'io.vertx:vertx-core'
|
||||
implementation 'org.apache.tuweni:tuweni-bytes'
|
||||
|
||||
testImplementation 'junit:junit'
|
||||
testImplementation 'org.assertj:assertj-core'
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter'
|
||||
|
||||
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine'
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.concurrent.CountDownLatch;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.apache.tuweni.bytes.Bytes;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
abstract class AbstractTaskQueueTest<T extends TaskCollection<Bytes>> {
|
||||
|
||||
|
||||
@@ -23,13 +23,13 @@ import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.tuweni.bytes.Bytes;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class CachingTaskCollectionTest {
|
||||
private TaskCollection<Bytes> wrappedTaskCollection;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
wrappedTaskCollection = new InMemoryTaskQueue<>();
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class InMemoryTasksPriorityQueuesTest {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user