Skip to content

Commit 5e282c8

Browse files
authored
convert to junit 5 / use assertj everywhere (#1092)
* include common test dependencies by default Signed-off-by: Gregor Zeitlinger <[email protected]> * convert to assertj Signed-off-by: Gregor Zeitlinger <[email protected]> * convert to assertj Signed-off-by: Gregor Zeitlinger <[email protected]> * convert to assertj Signed-off-by: Gregor Zeitlinger <[email protected]> * convert to assertj Signed-off-by: Gregor Zeitlinger <[email protected]> * convert to assertj Signed-off-by: Gregor Zeitlinger <[email protected]> * convert to assertj Signed-off-by: Gregor Zeitlinger <[email protected]> * convert to assertj Signed-off-by: Gregor Zeitlinger <[email protected]> * convert to assertj Signed-off-by: Gregor Zeitlinger <[email protected]> * convert to assertj Signed-off-by: Gregor Zeitlinger <[email protected]> * convert to assertj Signed-off-by: Gregor Zeitlinger <[email protected]> * convert to assertj Signed-off-by: Gregor Zeitlinger <[email protected]> * convert to assertj Signed-off-by: Gregor Zeitlinger <[email protected]> * convert to assertj Signed-off-by: Gregor Zeitlinger <[email protected]> * convert to assertj Signed-off-by: Gregor Zeitlinger <[email protected]> * convert to assertj Signed-off-by: Gregor Zeitlinger <[email protected]> * convert to assertj Signed-off-by: Gregor Zeitlinger <[email protected]> * convert to assertj Signed-off-by: Gregor Zeitlinger <[email protected]> * convert to assertj Signed-off-by: Gregor Zeitlinger <[email protected]> * convert to assertj Signed-off-by: Gregor Zeitlinger <[email protected]> * convert to assertj Signed-off-by: Gregor Zeitlinger <[email protected]> * convert to assertj Signed-off-by: Gregor Zeitlinger <[email protected]> * convert to assertj Signed-off-by: Gregor Zeitlinger <[email protected]> * convert to assertj Signed-off-by: Gregor Zeitlinger <[email protected]> * convert to assertj Signed-off-by: Gregor Zeitlinger <[email protected]> * convert to assertj Signed-off-by: Gregor Zeitlinger <[email protected]> * convert to assertj Signed-off-by: Gregor Zeitlinger <[email protected]> * convert to assertj Signed-off-by: Gregor Zeitlinger <[email protected]> * convert to assertj Signed-off-by: Gregor Zeitlinger <[email protected]> * convert to assertj Signed-off-by: Gregor Zeitlinger <[email protected]> * convert to assertj Signed-off-by: Gregor Zeitlinger <[email protected]> * convert to junit5 Signed-off-by: Gregor Zeitlinger <[email protected]> * convert to junit5 Signed-off-by: Gregor Zeitlinger <[email protected]> * convert to junit5 Signed-off-by: Gregor Zeitlinger <[email protected]> * convert to junit5 Signed-off-by: Gregor Zeitlinger <[email protected]> * convert to junit5 Signed-off-by: Gregor Zeitlinger <[email protected]> * convert to junit5 Signed-off-by: Gregor Zeitlinger <[email protected]> * convert to junit5 Signed-off-by: Gregor Zeitlinger <[email protected]> * convert to junit5 Signed-off-by: Gregor Zeitlinger <[email protected]> * convert to junit5 Signed-off-by: Gregor Zeitlinger <[email protected]> * convert to junit5 Signed-off-by: Gregor Zeitlinger <[email protected]> --------- Signed-off-by: Gregor Zeitlinger <[email protected]>
1 parent 0327d2f commit 5e282c8

File tree

118 files changed

+1926
-2139
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+1926
-2139
lines changed

examples/example-exporter-opentelemetry/src/main/java/io/prometheus/metrics/examples/opentelemetry/ManualCompleteMetricsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import java.util.Random;
1818
*/
1919

20-
public class ManualCompleteMetricsTest {
20+
class ManualCompleteMetricsTest {
2121

2222
// This contains a complete set of all metric types, and target_info and otel_scope_info.
2323
// I used this to expose in Prometheus format and OTLP format at the same time and compare the

integration-tests/it-common/src/test/java/io/prometheus/client/it/common/Volume.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
package io.prometheus.client.it.common;
22

33
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
4+
import static org.assertj.core.api.Assertions.assertThat;
5+
import static org.assertj.core.api.Assertions.fail;
46

57
import java.io.File;
68
import java.io.IOException;
79
import java.net.URISyntaxException;
810
import java.nio.file.*;
911
import java.nio.file.attribute.BasicFileAttributes;
1012
import java.util.function.Predicate;
11-
import org.junit.Assert;
1213

1314
/** Temporary directory in ./target/ to be mounted as a volume in Docker containers. */
1415
public class Volume {
@@ -21,8 +22,9 @@ private Volume(Path tmpDir) {
2122

2223
public static Volume create(String prefix) throws IOException, URISyntaxException {
2324
Path targetDir = Paths.get(Volume.class.getResource("/").toURI()).getParent();
24-
Assert.assertEquals(
25-
"failed to locate target/ directory", "target", targetDir.getFileName().toString());
25+
assertThat(targetDir.getFileName().toString())
26+
.as("failed to locate target/ directory")
27+
.isEqualTo("target");
2628
return new Volume(Files.createTempDirectory(targetDir, prefix + "-"));
2729
}
2830

@@ -59,7 +61,7 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
5961
}
6062
});
6163
} else {
62-
Assert.fail(src + ": No such file or directory");
64+
fail(src + ": No such file or directory");
6365
}
6466
return this;
6567
}

integration-tests/it-exporter/it-exporter-test/pom.xml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
34
<modelVersion>4.0.0</modelVersion>
45

56
<parent>
@@ -15,6 +16,10 @@
1516
Integration Tests for Exporters
1617
</description>
1718

19+
<properties>
20+
<maven.javadoc.skip>true</maven.javadoc.skip>
21+
</properties>
22+
1823
<licenses>
1924
<license>
2025
<name>The Apache Software License, Version 2.0</name>
@@ -37,12 +42,6 @@
3742
<artifactId>prometheus-metrics-exposition-formats</artifactId>
3843
<version>${project.version}</version>
3944
</dependency>
40-
<dependency>
41-
<groupId>junit</groupId>
42-
<artifactId>junit</artifactId>
43-
<version>4.13.2</version>
44-
<scope>test</scope>
45-
</dependency>
4645
<dependency>
4746
<groupId>org.testcontainers</groupId>
4847
<artifactId>testcontainers</artifactId>

0 commit comments

Comments
 (0)