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

Switch to junit 5 #2

Merged
merged 2 commits into from
Dec 8, 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
8 changes: 7 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,18 @@ subprojects {
}
}

test {
useJUnitPlatform()
}

// Standard libraries added to all projects
dependencies {
errorprone(libs.errorprone.core)
compileOnly libs.errorprone.annotations

testImplementation libs.junit
testImplementation(platform(libs.junit.bom))
testImplementation libs.junit.jupiter
testRuntimeOnly libs.junit.platform.launcher
}
}

5 changes: 4 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[versions]
jackson = "2.18.2"
junit = "5.11.3"
retrofit = "2.11.0"
dropwizard = "4.0.11"
errorprone = "2.36.0"
Expand All @@ -25,7 +26,9 @@ dropwizard-swagger = { module = "com.smoketurner:dropwizard-swagger", version =
jersey-media-sse = { module = "org.glassfish.jersey.media:jersey-media-sse", version = "3.1.9" }
jdbf = { module = "com.github.spyhunter99:jdbf", version = "2.2.4" }

junit = { module = "junit:junit", version = "4.13.2" }
junit-bom = { module = "org.junit:junit-bom", version.ref = "junit" }
junit-jupiter = { module = "org.junit.jupiter:junit-jupiter" }
junit-platform-launcher = { module = "org.junit.platform:junit-platform-launcher" }

[bundles]
jackson = ["jackson-bind", "jackson-yaml", "jackson-xml", "jackson-jsr310", "jackson-jdk8"]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package nl.bertriksikken.datex2;

import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -21,7 +21,7 @@ public void test() throws IOException {
LOG.info("Start parsing...");
measuredDataPublication = MeasuredDataPublication.parse(gzis);
}
Assert.assertFalse(measuredDataPublication.getSiteMeasurementsList().isEmpty());
Assertions.assertFalse(measuredDataPublication.getSiteMeasurementsList().isEmpty());
LOG.info("Got {} elements", measuredDataPublication.getSiteMeasurementsList().size());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
import nl.bertriksikken.geojson.FeatureCollection;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.io.File;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package nl.bertriksikken.verkeersdrukte.ndw;

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

import java.time.Instant;
import java.util.List;
Expand All @@ -15,9 +15,9 @@ public void test() {
Map<String, List<String>> headers = Map.of("Last-Modified", List.of("Tue, 3 Jun 2008 11:05:30 GMT"));
FileResponse response = FileResponse.create(200, headers, contents);

Assert.assertArrayEquals(contents, response.getContents());
Assertions.assertArrayEquals(contents, response.getContents());
Instant lastModified = response.getLastModified();
Assert.assertNotNull(lastModified);
Assertions.assertNotNull(lastModified);
}

}
Loading