junit4 to junit5 (#5600)

Signed-off-by: Nischal Sharma <nischal@web3labs.com>
Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com>
pull/5606/head
Nischal Sharma 1 year ago committed by GitHub
parent 54500740b6
commit 857c9ac0b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      metrics/core/build.gradle
  2. 8
      metrics/core/src/test/java/org/hyperledger/besu/metrics/RunnableTimedCounterTest.java
  3. 2
      metrics/core/src/test/java/org/hyperledger/besu/metrics/noop/NoOpMetricsSystemTest.java
  4. 12
      metrics/core/src/test/java/org/hyperledger/besu/metrics/opentelemetry/OpenTelemetryMetricsSystemTest.java
  5. 14
      metrics/core/src/test/java/org/hyperledger/besu/metrics/prometheus/MetricsHttpServiceTest.java
  6. 6
      metrics/core/src/test/java/org/hyperledger/besu/metrics/prometheus/PrometheusMetricsSystemTest.java

@ -65,10 +65,10 @@ dependencies {
testImplementation project(':util')
testImplementation 'com.squareup.okhttp3:okhttp'
testImplementation 'junit:junit'
testImplementation 'org.assertj:assertj-core'
testImplementation 'org.junit.jupiter:junit-jupiter'
testImplementation 'org.mockito:mockito-core'
testImplementation 'org.mockito:mockito-junit-jupiter'
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine'

@ -22,12 +22,12 @@ import org.hyperledger.besu.plugin.services.metrics.Counter;
import java.util.concurrent.TimeUnit;
import org.junit.Test;
import org.junit.runner.RunWith;
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 RunnableTimedCounterTest {
@Mock Counter backedCounter;

@ -23,7 +23,7 @@ import org.hyperledger.besu.plugin.services.metrics.Counter;
import org.hyperledger.besu.plugin.services.metrics.LabelledMetric;
import org.hyperledger.besu.plugin.services.metrics.OperationTimer;
import org.junit.Test;
import org.junit.jupiter.api.Test;
public class NoOpMetricsSystemTest {

@ -43,9 +43,9 @@ import java.util.stream.Stream;
import com.google.common.collect.ImmutableSet;
import io.opentelemetry.api.GlobalOpenTelemetry;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
public class OpenTelemetryMetricsSystemTest {
@ -54,7 +54,7 @@ public class OpenTelemetryMetricsSystemTest {
.thenComparing(Observation::getMetricName)
.thenComparing((o1, o2) -> o1.getLabels().equals(o2.getLabels()) ? 0 : 1);
@Before
@BeforeEach
public void resetGlobalOpenTelemetry() {
GlobalOpenTelemetry.resetForTest();
}
@ -74,12 +74,12 @@ public class OpenTelemetryMetricsSystemTest {
return null;
}
@Before
@BeforeEach
public void setUp() {
metricsSystem = new OpenTelemetrySystem(DEFAULT_METRIC_CATEGORIES, true, "job", false);
}
@After
@AfterEach
public void tearDown() {
metricsSystem.shutdown();
}

@ -29,23 +29,19 @@ import io.vertx.core.Vertx;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
public class MetricsHttpServiceTest {
@ClassRule public static final TemporaryFolder folder = new TemporaryFolder();
private static final Vertx vertx = Vertx.vertx();
private static MetricsHttpService service;
private static OkHttpClient client;
private static String baseUrl;
@BeforeClass
@BeforeAll
public static void initServerAndClient() {
service = createMetricsHttpService();
service.start().join();
@ -76,7 +72,7 @@ public class MetricsHttpServiceTest {
}
/** Tears down the HTTP server. */
@AfterClass
@AfterAll
public static void shutdownServer() {
service.stop().join();
vertx.close();

@ -42,8 +42,8 @@ import java.util.List;
import com.google.common.collect.ImmutableSet;
import io.opentelemetry.api.GlobalOpenTelemetry;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
public class PrometheusMetricsSystemTest {
@ -52,7 +52,7 @@ public class PrometheusMetricsSystemTest {
.thenComparing(Observation::getMetricName)
.thenComparing((o1, o2) -> o1.getLabels().equals(o2.getLabels()) ? 0 : 1);
@Before
@BeforeEach
public void resetGlobalOpenTelemetry() {
GlobalOpenTelemetry.resetForTest();
}

Loading…
Cancel
Save