diff --git a/java-client/build.gradle.kts b/java-client/build.gradle.kts index 12a442871..16237cf3a 100644 --- a/java-client/build.gradle.kts +++ b/java-client/build.gradle.kts @@ -26,8 +26,8 @@ plugins { `java-library` checkstyle `maven-publish` - id("com.github.jk1.dependency-license-report") version "1.17" - id("de.thetaphi.forbiddenapis") version "3.2" + id("com.github.jk1.dependency-license-report") version "1.19" + id("de.thetaphi.forbiddenapis") version "3.3" } java { @@ -171,8 +171,8 @@ publishing { dependencies { // Compile and test with the last 7.x version to make sure transition scenarios where // the Java API client coexists with a 7.x HLRC work fine - val elasticsearchVersion = "7.17.1" - val jacksonVersion = "2.13.1" + val elasticsearchVersion = "7.17.4" + val jacksonVersion = "2.13.3" // Apache 2.0 // https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/java-rest-low.html @@ -205,23 +205,24 @@ dependencies { // EPL-2.0 OR BSD-3-Clause // https://eclipse-ee4j.github.io/yasson/ - testImplementation("org.eclipse", "yasson", "2.0.2") { + testImplementation("org.eclipse", "yasson", "2.0.4") { // Exclude Glassfish as we use Parsson (basically Glassfish renamed in the Jakarta namespace). exclude(group = "org.glassfish", module = "jakarta.json") } - // EPL-1.0 - // https://junit.org/junit4/ - testImplementation("junit", "junit" , "4.13.2") + // EPL-2.0 + // https://junit.org/junit5/ + testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2") + testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.8.2") // MIT // https://github.com/classgraph/classgraph - testImplementation("io.github.classgraph:classgraph:4.8.116") + testImplementation("io.github.classgraph:classgraph:4.8.147") // MIT // https://www.testcontainers.org/ - testImplementation("org.testcontainers", "testcontainers", "1.16.3") - testImplementation("org.testcontainers", "elasticsearch", "1.16.3") + testImplementation("org.testcontainers", "testcontainers", "1.17.2") + testImplementation("org.testcontainers", "elasticsearch", "1.17.2") } @@ -238,6 +239,7 @@ class SpdxReporter(val dest: File) : ReportRenderer { "BSD Zero Clause License" to "0BSD", "Eclipse Public License 2.0" to "EPL-2.0", "Eclipse Public License v. 2.0" to "EPL-2.0", + "Eclipse Public License - v 2.0" to "EPL-2.0", "GNU General Public License, version 2 with the GNU Classpath Exception" to "GPL-2.0 WITH Classpath-exception-2.0", "COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0" to "CDDL-1.0" ) diff --git a/java-client/src/test/java/co/elastic/clients/documentation/api_conventions/ApiConventionsTest.java b/java-client/src/test/java/co/elastic/clients/documentation/api_conventions/ApiConventionsTest.java index 31dee9305..da23df5bb 100644 --- a/java-client/src/test/java/co/elastic/clients/documentation/api_conventions/ApiConventionsTest.java +++ b/java-client/src/test/java/co/elastic/clients/documentation/api_conventions/ApiConventionsTest.java @@ -33,8 +33,8 @@ import co.elastic.clients.elasticsearch.indices.CreateIndexResponse; import co.elastic.clients.transport.ElasticsearchTransport; import co.elastic.clients.util.ApiTypeHelper; -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; @@ -43,7 +43,7 @@ import java.util.List; import java.util.Map; -public class ApiConventionsTest extends Assert { +public class ApiConventionsTest extends Assertions { private static class SomeApplicationData {} diff --git a/java-client/src/test/java/co/elastic/clients/documentation/api_conventions/LoadingJsonTest.java b/java-client/src/test/java/co/elastic/clients/documentation/api_conventions/LoadingJsonTest.java index 867d922c4..8d0f9ef5f 100644 --- a/java-client/src/test/java/co/elastic/clients/documentation/api_conventions/LoadingJsonTest.java +++ b/java-client/src/test/java/co/elastic/clients/documentation/api_conventions/LoadingJsonTest.java @@ -31,8 +31,8 @@ import co.elastic.clients.elasticsearch.indices.CreateIndexResponse; import co.elastic.clients.elasticsearch.model.ModelTestCase; import co.elastic.clients.json.JsonData; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import java.io.File; import java.io.FileReader; @@ -86,8 +86,8 @@ public void loadIndexDefinition() throws IOException { //end::load-index } + @Disabled @Test - @Ignore public void ingestDocument() throws IOException { File dataDir = null; diff --git a/java-client/src/test/java/co/elastic/clients/documentation/getting_started/ConnectingTest.java b/java-client/src/test/java/co/elastic/clients/documentation/getting_started/ConnectingTest.java index 7fee39785..2af6c01ec 100644 --- a/java-client/src/test/java/co/elastic/clients/documentation/getting_started/ConnectingTest.java +++ b/java-client/src/test/java/co/elastic/clients/documentation/getting_started/ConnectingTest.java @@ -28,12 +28,12 @@ import co.elastic.clients.transport.rest_client.RestClientTransport; import org.apache.http.HttpHost; import org.elasticsearch.client.RestClient; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; public class ConnectingTest { - @Ignore // we don't have a running ES + @Disabled // we don't have a running ES @Test public void createClient() throws Exception { //tag::create-client diff --git a/java-client/src/test/java/co/elastic/clients/documentation/getting_started/MigrateHlrcTest.java b/java-client/src/test/java/co/elastic/clients/documentation/getting_started/MigrateHlrcTest.java index 9a5a3cbb4..e857188b7 100644 --- a/java-client/src/test/java/co/elastic/clients/documentation/getting_started/MigrateHlrcTest.java +++ b/java-client/src/test/java/co/elastic/clients/documentation/getting_started/MigrateHlrcTest.java @@ -25,7 +25,7 @@ import co.elastic.clients.transport.rest_client.RestClientTransport; import org.apache.http.HttpHost; import org.elasticsearch.client.RestClient; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class MigrateHlrcTest { diff --git a/java-client/src/test/java/co/elastic/clients/documentation/usage/AggregationsTest.java b/java-client/src/test/java/co/elastic/clients/documentation/usage/AggregationsTest.java index 2e5606d47..b548a8ea2 100644 --- a/java-client/src/test/java/co/elastic/clients/documentation/usage/AggregationsTest.java +++ b/java-client/src/test/java/co/elastic/clients/documentation/usage/AggregationsTest.java @@ -28,7 +28,7 @@ import co.elastic.clients.elasticsearch.core.search.TotalHitsRelation; import co.elastic.clients.elasticsearch.model.ModelTestCase; import co.elastic.clients.json.JsonData; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/java-client/src/test/java/co/elastic/clients/documentation/usage/IndexingBulkTest.java b/java-client/src/test/java/co/elastic/clients/documentation/usage/IndexingBulkTest.java index 4663ce44a..3c9d56253 100644 --- a/java-client/src/test/java/co/elastic/clients/documentation/usage/IndexingBulkTest.java +++ b/java-client/src/test/java/co/elastic/clients/documentation/usage/IndexingBulkTest.java @@ -28,7 +28,7 @@ import co.elastic.clients.json.JsonData; import co.elastic.clients.json.JsonpMapper; import jakarta.json.spi.JsonProvider; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/java-client/src/test/java/co/elastic/clients/documentation/usage/IndexingTest.java b/java-client/src/test/java/co/elastic/clients/documentation/usage/IndexingTest.java index aed7d4d32..57318ba3f 100644 --- a/java-client/src/test/java/co/elastic/clients/documentation/usage/IndexingTest.java +++ b/java-client/src/test/java/co/elastic/clients/documentation/usage/IndexingTest.java @@ -27,7 +27,7 @@ import co.elastic.clients.elasticsearch.core.IndexResponse; import co.elastic.clients.elasticsearch.model.ModelTestCase; import co.elastic.clients.json.JsonData; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/java-client/src/test/java/co/elastic/clients/documentation/usage/ReadingTest.java b/java-client/src/test/java/co/elastic/clients/documentation/usage/ReadingTest.java index 053a5476f..6f7cdcf1a 100644 --- a/java-client/src/test/java/co/elastic/clients/documentation/usage/ReadingTest.java +++ b/java-client/src/test/java/co/elastic/clients/documentation/usage/ReadingTest.java @@ -24,7 +24,7 @@ import co.elastic.clients.elasticsearch.core.GetResponse; import co.elastic.clients.elasticsearch.model.ModelTestCase; import com.fasterxml.jackson.databind.node.ObjectNode; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/java-client/src/test/java/co/elastic/clients/documentation/usage/SearchingTest.java b/java-client/src/test/java/co/elastic/clients/documentation/usage/SearchingTest.java index fe9c3fd94..8c26b146b 100644 --- a/java-client/src/test/java/co/elastic/clients/documentation/usage/SearchingTest.java +++ b/java-client/src/test/java/co/elastic/clients/documentation/usage/SearchingTest.java @@ -29,7 +29,7 @@ import co.elastic.clients.elasticsearch.core.search.TotalHits; import co.elastic.clients.elasticsearch.core.search.TotalHitsRelation; import co.elastic.clients.json.JsonData; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/java-client/src/test/java/co/elastic/clients/elasticsearch/ElasticsearchTestServer.java b/java-client/src/test/java/co/elastic/clients/elasticsearch/ElasticsearchTestServer.java index 99b917cca..207d10814 100644 --- a/java-client/src/test/java/co/elastic/clients/elasticsearch/ElasticsearchTestServer.java +++ b/java-client/src/test/java/co/elastic/clients/elasticsearch/ElasticsearchTestServer.java @@ -62,7 +62,7 @@ public static synchronized ElasticsearchTestServer global() { } private synchronized void setup() { - container = new ElasticsearchContainer("docker.elastic.co/elasticsearch/elasticsearch:7.17.1") + container = new ElasticsearchContainer("docker.elastic.co/elasticsearch/elasticsearch:7.17.4") .withEnv("ES_JAVA_OPTS", "-Xms256m -Xmx256m") .withEnv("path.repo", "/tmp") // for snapshots .withStartupTimeout(Duration.ofSeconds(60)) diff --git a/java-client/src/test/java/co/elastic/clients/elasticsearch/end_to_end/RequestTest.java b/java-client/src/test/java/co/elastic/clients/elasticsearch/end_to_end/RequestTest.java index f267163b6..b46f117e9 100644 --- a/java-client/src/test/java/co/elastic/clients/elasticsearch/end_to_end/RequestTest.java +++ b/java-client/src/test/java/co/elastic/clients/elasticsearch/end_to_end/RequestTest.java @@ -44,9 +44,9 @@ import co.elastic.clients.elasticsearch.indices.IndexState; import co.elastic.clients.elasticsearch.model.ModelTestCase; import co.elastic.clients.transport.endpoints.BooleanResponse; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import java.io.IOException; import java.util.Collections; @@ -55,11 +55,11 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; -public class RequestTest extends Assert { +public class RequestTest extends Assertions { static ElasticsearchClient client; - @BeforeClass + @BeforeAll public static void setup() { client = ElasticsearchTestServer.global().client(); } diff --git a/java-client/src/test/java/co/elastic/clients/elasticsearch/experiments/ClientTests.java b/java-client/src/test/java/co/elastic/clients/elasticsearch/experiments/ClientTests.java index e33c8339f..2b5d9332a 100644 --- a/java-client/src/test/java/co/elastic/clients/elasticsearch/experiments/ClientTests.java +++ b/java-client/src/test/java/co/elastic/clients/elasticsearch/experiments/ClientTests.java @@ -26,7 +26,7 @@ import co.elastic.clients.elasticsearch.experiments.api.query2.TermsQuery; import co.elastic.clients.elasticsearch.experiments.base.Client; import co.elastic.clients.transport.Endpoint; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.IOException; import java.util.Collections; diff --git a/java-client/src/test/java/co/elastic/clients/elasticsearch/experiments/ParsingTests.java b/java-client/src/test/java/co/elastic/clients/elasticsearch/experiments/ParsingTests.java index 94a4f33d5..af207e644 100644 --- a/java-client/src/test/java/co/elastic/clients/elasticsearch/experiments/ParsingTests.java +++ b/java-client/src/test/java/co/elastic/clients/elasticsearch/experiments/ParsingTests.java @@ -26,14 +26,14 @@ import jakarta.json.stream.JsonGenerator; import jakarta.json.stream.JsonParser; import jakarta.json.stream.JsonParsingException; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.nio.charset.StandardCharsets; -public class ParsingTests extends Assert { +public class ParsingTests extends Assertions { @Test public void testFoo() throws Exception { diff --git a/java-client/src/test/java/co/elastic/clients/elasticsearch/experiments/api/query2/QueryTest.java b/java-client/src/test/java/co/elastic/clients/elasticsearch/experiments/api/query2/QueryTest.java index 1f82adc82..313905268 100644 --- a/java-client/src/test/java/co/elastic/clients/elasticsearch/experiments/api/query2/QueryTest.java +++ b/java-client/src/test/java/co/elastic/clients/elasticsearch/experiments/api/query2/QueryTest.java @@ -19,12 +19,12 @@ package co.elastic.clients.elasticsearch.experiments.api.query2; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import java.util.Collection; -public class QueryTest extends Assert { +public class QueryTest extends Assertions { @Test public void testQuery() { BoolQuery bq = new BoolQuery.Builder().build(); diff --git a/java-client/src/test/java/co/elastic/clients/elasticsearch/experiments/containers/SomeUnionTest.java b/java-client/src/test/java/co/elastic/clients/elasticsearch/experiments/containers/SomeUnionTest.java index 8481916b0..2ce528a6c 100644 --- a/java-client/src/test/java/co/elastic/clients/elasticsearch/experiments/containers/SomeUnionTest.java +++ b/java-client/src/test/java/co/elastic/clients/elasticsearch/experiments/containers/SomeUnionTest.java @@ -26,7 +26,7 @@ import jakarta.json.stream.JsonGenerator; import jakarta.json.stream.JsonParser; import jakarta.json.stream.JsonParsingException; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.ByteArrayOutputStream; import java.io.StringReader; diff --git a/java-client/src/test/java/co/elastic/clients/elasticsearch/experiments/inheritance/InheritanceTest.java b/java-client/src/test/java/co/elastic/clients/elasticsearch/experiments/inheritance/InheritanceTest.java index 97c1b97fb..ddd636af9 100644 --- a/java-client/src/test/java/co/elastic/clients/elasticsearch/experiments/inheritance/InheritanceTest.java +++ b/java-client/src/test/java/co/elastic/clients/elasticsearch/experiments/inheritance/InheritanceTest.java @@ -26,13 +26,13 @@ import jakarta.json.spi.JsonProvider; import jakarta.json.stream.JsonGenerator; import jakarta.json.stream.JsonParser; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import java.io.ByteArrayOutputStream; import java.io.StringReader; -public class InheritanceTest extends Assert { +public class InheritanceTest extends Assertions { @Test public void testSerialization() { diff --git a/java-client/src/test/java/co/elastic/clients/elasticsearch/json/JsonDataTest.java b/java-client/src/test/java/co/elastic/clients/elasticsearch/json/JsonDataTest.java index e9cfed2eb..1c9fd1c96 100644 --- a/java-client/src/test/java/co/elastic/clients/elasticsearch/json/JsonDataTest.java +++ b/java-client/src/test/java/co/elastic/clients/elasticsearch/json/JsonDataTest.java @@ -34,14 +34,14 @@ import jakarta.json.JsonValue; import jakarta.json.stream.JsonGenerator; import jakarta.json.stream.JsonParser; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import java.io.Reader; import java.io.StringReader; import java.io.StringWriter; -public class JsonDataTest extends Assert { +public class JsonDataTest extends Assertions { public static > B withJson(B builder, Reader json, ElasticsearchClient client) { diff --git a/java-client/src/test/java/co/elastic/clients/elasticsearch/json/JsonpMapperTest.java b/java-client/src/test/java/co/elastic/clients/elasticsearch/json/JsonpMapperTest.java index 610ce0f41..02ecbf783 100644 --- a/java-client/src/test/java/co/elastic/clients/elasticsearch/json/JsonpMapperTest.java +++ b/java-client/src/test/java/co/elastic/clients/elasticsearch/json/JsonpMapperTest.java @@ -27,15 +27,15 @@ import com.fasterxml.jackson.databind.PropertyNamingStrategies; import jakarta.json.stream.JsonGenerator; import jakarta.json.stream.JsonParser; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import java.io.StringReader; import java.io.StringWriter; import java.util.Collections; import java.util.List; -public class JsonpMapperTest extends Assert { +public class JsonpMapperTest extends Assertions { String json = "{\"children\":[{\"doubleValue\":3.2,\"intValue\":2}],\"doubleValue\":2.1,\"intValue\":1," + "\"stringValue\":\"foo\"}"; diff --git a/java-client/src/test/java/co/elastic/clients/elasticsearch/json/JsonpUtilsTest.java b/java-client/src/test/java/co/elastic/clients/elasticsearch/json/JsonpUtilsTest.java index a5dbd4826..8978e3429 100644 --- a/java-client/src/test/java/co/elastic/clients/elasticsearch/json/JsonpUtilsTest.java +++ b/java-client/src/test/java/co/elastic/clients/elasticsearch/json/JsonpUtilsTest.java @@ -25,8 +25,8 @@ import jakarta.json.JsonException; import jakarta.json.spi.JsonProvider; import jakarta.json.stream.JsonGenerator; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import java.io.StringWriter; import java.net.URL; @@ -34,7 +34,7 @@ import java.util.Enumeration; import java.util.function.Consumer; -public class JsonpUtilsTest extends Assert { +public class JsonpUtilsTest extends Assertions { @Test @AllowForbiddenApis("Testing JsonpUtil.provider()") diff --git a/java-client/src/test/java/co/elastic/clients/elasticsearch/json/jackson/JacksonJsonpParserTest.java b/java-client/src/test/java/co/elastic/clients/elasticsearch/json/jackson/JacksonJsonpParserTest.java index be736dbfc..bd8bc28fa 100644 --- a/java-client/src/test/java/co/elastic/clients/elasticsearch/json/jackson/JacksonJsonpParserTest.java +++ b/java-client/src/test/java/co/elastic/clients/elasticsearch/json/jackson/JacksonJsonpParserTest.java @@ -22,12 +22,12 @@ import co.elastic.clients.json.jackson.JacksonJsonProvider; import jakarta.json.stream.JsonParser; import jakarta.json.stream.JsonParser.Event; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import java.io.StringReader; -public class JacksonJsonpParserTest extends Assert { +public class JacksonJsonpParserTest extends Assertions { private static final String json = "{ 'foo': 'fooValue', 'bar': { 'baz': 1}, 'quux': [true] }".replace('\'', '"'); diff --git a/java-client/src/test/java/co/elastic/clients/elasticsearch/json/jackson/JacksonMapperTest.java b/java-client/src/test/java/co/elastic/clients/elasticsearch/json/jackson/JacksonMapperTest.java index 880e105f8..c399d7a11 100644 --- a/java-client/src/test/java/co/elastic/clients/elasticsearch/json/jackson/JacksonMapperTest.java +++ b/java-client/src/test/java/co/elastic/clients/elasticsearch/json/jackson/JacksonMapperTest.java @@ -29,7 +29,7 @@ import com.fasterxml.jackson.databind.JsonDeserializer; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.IOException; diff --git a/java-client/src/test/java/co/elastic/clients/elasticsearch/json/jackson/JsonValueParserTest.java b/java-client/src/test/java/co/elastic/clients/elasticsearch/json/jackson/JsonValueParserTest.java index bed4b2c1b..f3be5fe5c 100644 --- a/java-client/src/test/java/co/elastic/clients/elasticsearch/json/jackson/JsonValueParserTest.java +++ b/java-client/src/test/java/co/elastic/clients/elasticsearch/json/jackson/JsonValueParserTest.java @@ -25,13 +25,14 @@ import jakarta.json.JsonObject; import jakarta.json.JsonValue; import jakarta.json.stream.JsonParser; -import org.junit.Assert; -import org.junit.Test; import java.io.StringReader; import java.util.Map; -public class JsonValueParserTest extends Assert { +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class JsonValueParserTest extends Assertions { public static class Data { public Map data; diff --git a/java-client/src/test/java/co/elastic/clients/elasticsearch/model/BehaviorsTest.java b/java-client/src/test/java/co/elastic/clients/elasticsearch/model/BehaviorsTest.java index a74bab848..a23d387bc 100644 --- a/java-client/src/test/java/co/elastic/clients/elasticsearch/model/BehaviorsTest.java +++ b/java-client/src/test/java/co/elastic/clients/elasticsearch/model/BehaviorsTest.java @@ -31,7 +31,7 @@ import co.elastic.clients.elasticsearch._types.query_dsl.TermQuery; import co.elastic.clients.json.JsonData; import co.elastic.clients.util.MapBuilder; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class BehaviorsTest extends ModelTestCase { diff --git a/java-client/src/test/java/co/elastic/clients/elasticsearch/model/BuiltinTypesTest.java b/java-client/src/test/java/co/elastic/clients/elasticsearch/model/BuiltinTypesTest.java index 73b909053..36a718e3b 100644 --- a/java-client/src/test/java/co/elastic/clients/elasticsearch/model/BuiltinTypesTest.java +++ b/java-client/src/test/java/co/elastic/clients/elasticsearch/model/BuiltinTypesTest.java @@ -30,7 +30,7 @@ import co.elastic.clients.elasticsearch.indices.IndexRoutingAllocationDisk; import co.elastic.clients.json.JsonpDeserializer; import jakarta.json.stream.JsonParser; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.StringReader; import java.util.List; diff --git a/java-client/src/test/java/co/elastic/clients/elasticsearch/model/ClassStructureTest.java b/java-client/src/test/java/co/elastic/clients/elasticsearch/model/ClassStructureTest.java index 6955a38b4..68e8f899c 100644 --- a/java-client/src/test/java/co/elastic/clients/elasticsearch/model/ClassStructureTest.java +++ b/java-client/src/test/java/co/elastic/clients/elasticsearch/model/ClassStructureTest.java @@ -38,7 +38,7 @@ import co.elastic.clients.util.ApiTypeHelper; import co.elastic.clients.util.MissingRequiredPropertyException; import co.elastic.clients.util.ObjectBuilder; -import org.junit.Test; +import org.junit.jupiter.api.Test; import javax.annotation.Nullable; import java.lang.reflect.Method; diff --git a/java-client/src/test/java/co/elastic/clients/elasticsearch/model/EndpointTest.java b/java-client/src/test/java/co/elastic/clients/elasticsearch/model/EndpointTest.java index 1358d7a03..1065c2c5f 100644 --- a/java-client/src/test/java/co/elastic/clients/elasticsearch/model/EndpointTest.java +++ b/java-client/src/test/java/co/elastic/clients/elasticsearch/model/EndpointTest.java @@ -24,10 +24,10 @@ import co.elastic.clients.elasticsearch.core.InfoRequest; import co.elastic.clients.elasticsearch.core.SearchRequest; import co.elastic.clients.elasticsearch.indices.RefreshRequest; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; -public class EndpointTest extends Assert { +public class EndpointTest extends Assertions { @Test public void testArrayPathParameter() { diff --git a/java-client/src/test/java/co/elastic/clients/elasticsearch/model/EnumTest.java b/java-client/src/test/java/co/elastic/clients/elasticsearch/model/EnumTest.java index a6f5cf4f4..c26261589 100644 --- a/java-client/src/test/java/co/elastic/clients/elasticsearch/model/EnumTest.java +++ b/java-client/src/test/java/co/elastic/clients/elasticsearch/model/EnumTest.java @@ -22,7 +22,7 @@ import co.elastic.clients.elasticsearch._types.Bytes; import co.elastic.clients.elasticsearch._types.Refresh; import co.elastic.clients.elasticsearch._types.mapping.GeoOrientation; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.Arrays; diff --git a/java-client/src/test/java/co/elastic/clients/elasticsearch/model/ModelTestCase.java b/java-client/src/test/java/co/elastic/clients/elasticsearch/model/ModelTestCase.java index 39e5a7cf9..c066c54b5 100644 --- a/java-client/src/test/java/co/elastic/clients/elasticsearch/model/ModelTestCase.java +++ b/java-client/src/test/java/co/elastic/clients/elasticsearch/model/ModelTestCase.java @@ -27,7 +27,7 @@ import jakarta.json.spi.JsonProvider; import jakarta.json.stream.JsonGenerator; import jakarta.json.stream.JsonParser; -import org.junit.Assert; +import org.junit.jupiter.api.Assertions; import java.io.StringReader; import java.io.StringWriter; @@ -37,7 +37,7 @@ /** * Base class for tests that encode/decode json */ -public abstract class ModelTestCase extends Assert { +public abstract class ModelTestCase extends Assertions { // Same value for all tests in a test run private static final int RAND = new Random().nextInt(100); @@ -122,10 +122,10 @@ public static void assertGetterType(Class expected, Class clazz, String na try { method = clazz.getMethod(name); } catch (NoSuchMethodException e) { - Assert.fail("Getter '" + clazz.getName() + "." + name + "' doesn't exist"); + fail("Getter '" + clazz.getName() + "." + name + "' doesn't exist"); return; } - Assert.assertSame(expected, method.getReturnType()); + assertSame(expected, method.getReturnType()); } } diff --git a/java-client/src/test/java/co/elastic/clients/elasticsearch/model/RequestEncodingTest.java b/java-client/src/test/java/co/elastic/clients/elasticsearch/model/RequestEncodingTest.java index 1526b6164..e9d4b83ed 100644 --- a/java-client/src/test/java/co/elastic/clients/elasticsearch/model/RequestEncodingTest.java +++ b/java-client/src/test/java/co/elastic/clients/elasticsearch/model/RequestEncodingTest.java @@ -21,7 +21,7 @@ import co.elastic.clients.elasticsearch.core.SearchRequest; import co.elastic.clients.json.jsonb.JsonbJsonpMapper; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class RequestEncodingTest extends ModelTestCase { diff --git a/java-client/src/test/java/co/elastic/clients/elasticsearch/model/SerializationTest.java b/java-client/src/test/java/co/elastic/clients/elasticsearch/model/SerializationTest.java index 2dea3d563..30abebc37 100644 --- a/java-client/src/test/java/co/elastic/clients/elasticsearch/model/SerializationTest.java +++ b/java-client/src/test/java/co/elastic/clients/elasticsearch/model/SerializationTest.java @@ -33,7 +33,7 @@ import jakarta.json.JsonValue; import jakarta.json.stream.JsonParser; import jakarta.json.stream.JsonParsingException; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.StringReader; @@ -50,7 +50,7 @@ public void loadAllDeserializers() throws Exception { ClassInfoList withAnnotation = scan.getClassesWithAnnotation(JsonpDeserializable.class.getName()); - assertFalse("No JsonpDeserializable classes", withAnnotation.isEmpty()); + assertFalse(withAnnotation.isEmpty(), "No JsonpDeserializable classes"); for (ClassInfo info: withAnnotation) { Class clazz = Class.forName(info.getName()); @@ -59,12 +59,12 @@ public void loadAllDeserializers() throws Exception { // Deserialize something dummy to resolve lazy deserializers JsonParser parser = mapper.jsonProvider().createParser(new StringReader("-")); - assertThrows(info.getName(), JsonParsingException.class, () -> deserializer.deserialize(parser, mapper)); + assertThrows(JsonParsingException.class, () -> deserializer.deserialize(parser, mapper), info.getName()); } // Check that all classes that have a _DESERIALIZER field also have the annotation ClassInfoList withDeserializer = scan.getAllClasses().filter((c) -> c.hasDeclaredField("_DESERIALIZER")); - assertFalse("No classes with a _DESERIALIZER field", withDeserializer.isEmpty()); + assertFalse(withDeserializer.isEmpty(), "No classes with a _DESERIALIZER field"); // Disabled for now, empty response classes still need a deserializer object // e.g. ExistsIndexTemplateResponse, PingResponse, ExistsResponse, ExistsAliasResponse diff --git a/java-client/src/test/java/co/elastic/clients/elasticsearch/model/TypedKeysTest.java b/java-client/src/test/java/co/elastic/clients/elasticsearch/model/TypedKeysTest.java index cafb5e186..6af52daba 100644 --- a/java-client/src/test/java/co/elastic/clients/elasticsearch/model/TypedKeysTest.java +++ b/java-client/src/test/java/co/elastic/clients/elasticsearch/model/TypedKeysTest.java @@ -28,7 +28,7 @@ import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.util.ListBuilder; import co.elastic.clients.util.MapBuilder; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.Collections; diff --git a/java-client/src/test/java/co/elastic/clients/elasticsearch/model/UnionTests.java b/java-client/src/test/java/co/elastic/clients/elasticsearch/model/UnionTests.java index de4cf73f3..185cf7067 100644 --- a/java-client/src/test/java/co/elastic/clients/elasticsearch/model/UnionTests.java +++ b/java-client/src/test/java/co/elastic/clients/elasticsearch/model/UnionTests.java @@ -22,7 +22,7 @@ import co.elastic.clients.elasticsearch._types.Script; import co.elastic.clients.elasticsearch._types.query_dsl.SimpleQueryStringFlag; import co.elastic.clients.elasticsearch._types.query_dsl.SimpleQueryStringFlags; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class UnionTests extends ModelTestCase { diff --git a/java-client/src/test/java/co/elastic/clients/elasticsearch/model/VariantsTest.java b/java-client/src/test/java/co/elastic/clients/elasticsearch/model/VariantsTest.java index 37499d454..9401d2404 100644 --- a/java-client/src/test/java/co/elastic/clients/elasticsearch/model/VariantsTest.java +++ b/java-client/src/test/java/co/elastic/clients/elasticsearch/model/VariantsTest.java @@ -27,7 +27,7 @@ import co.elastic.clients.elasticsearch.core.SearchRequest; import co.elastic.clients.elasticsearch.indices.GetMappingResponse; import co.elastic.clients.json.JsonData; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class VariantsTest extends ModelTestCase { diff --git a/java-client/src/test/java/co/elastic/clients/elasticsearch/spec_issues/SpecIssuesTest.java b/java-client/src/test/java/co/elastic/clients/elasticsearch/spec_issues/SpecIssuesTest.java index beb5b96c5..6b9826b35 100644 --- a/java-client/src/test/java/co/elastic/clients/elasticsearch/spec_issues/SpecIssuesTest.java +++ b/java-client/src/test/java/co/elastic/clients/elasticsearch/spec_issues/SpecIssuesTest.java @@ -31,7 +31,7 @@ import co.elastic.clients.json.JsonData; import co.elastic.clients.json.JsonpDeserializer; import jakarta.json.stream.JsonParser; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.InputStream; @@ -117,7 +117,7 @@ public void i0056_hitsMetadataTotal() throws Exception { private T loadRsrc(String res, JsonpDeserializer deser) { InputStream is = this.getClass().getResourceAsStream(res); - assertNotNull("Resource not found: " + res, is); + assertNotNull(is, "Resource not found: " + res); JsonParser parser = mapper.jsonProvider().createParser(is); return deser.deserialize(parser, mapper); } diff --git a/java-client/src/test/java/co/elastic/clients/json/JsonpMappingExceptionTest.java b/java-client/src/test/java/co/elastic/clients/json/JsonpMappingExceptionTest.java index 4c753459d..07c19c43c 100644 --- a/java-client/src/test/java/co/elastic/clients/json/JsonpMappingExceptionTest.java +++ b/java-client/src/test/java/co/elastic/clients/json/JsonpMappingExceptionTest.java @@ -22,7 +22,7 @@ import co.elastic.clients.elasticsearch._types.mapping.TypeMapping; import co.elastic.clients.elasticsearch.core.SearchResponse; import co.elastic.clients.elasticsearch.model.ModelTestCase; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.StringReader; diff --git a/java-client/src/test/java/co/elastic/clients/json/LazyDeserializerTest.java b/java-client/src/test/java/co/elastic/clients/json/LazyDeserializerTest.java index 9c2ac4075..fef389daf 100644 --- a/java-client/src/test/java/co/elastic/clients/json/LazyDeserializerTest.java +++ b/java-client/src/test/java/co/elastic/clients/json/LazyDeserializerTest.java @@ -19,13 +19,12 @@ package co.elastic.clients.json; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import java.util.concurrent.CompletableFuture; -public class LazyDeserializerTest extends Assert { - +public class LazyDeserializerTest extends Assertions { @Test public void testConcurrentInit() throws Exception { diff --git a/java-client/src/test/java/co/elastic/clients/json/WithJsonTest.java b/java-client/src/test/java/co/elastic/clients/json/WithJsonTest.java index 3ba6ba9c3..59f22a7bc 100644 --- a/java-client/src/test/java/co/elastic/clients/json/WithJsonTest.java +++ b/java-client/src/test/java/co/elastic/clients/json/WithJsonTest.java @@ -29,7 +29,7 @@ import co.elastic.clients.elasticsearch.core.SearchResponse; import co.elastic.clients.elasticsearch.indices.PutIndicesSettingsRequest; import co.elastic.clients.elasticsearch.model.ModelTestCase; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.StringReader; diff --git a/java-client/src/test/java/co/elastic/clients/transport/RequestOptionsTest.java b/java-client/src/test/java/co/elastic/clients/transport/RequestOptionsTest.java index fdf598815..43c56f612 100644 --- a/java-client/src/test/java/co/elastic/clients/transport/RequestOptionsTest.java +++ b/java-client/src/test/java/co/elastic/clients/transport/RequestOptionsTest.java @@ -28,10 +28,10 @@ import org.apache.http.client.utils.URLEncodedUtils; import org.elasticsearch.client.ResponseException; import org.elasticsearch.client.RestClient; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.io.IOException; import java.io.OutputStreamWriter; @@ -43,12 +43,12 @@ import java.util.Map; import java.util.Properties; -public class RequestOptionsTest extends Assert { +public class RequestOptionsTest extends Assertions { private static HttpServer httpServer; private static RestClient restClient; - @Before + @BeforeEach public void classSetup() throws IOException { httpServer = HttpServer.create(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0), 0); @@ -86,7 +86,7 @@ public void classSetup() throws IOException { .build(); } - @After + @AfterEach public void classTearDown() throws IOException { httpServer.stop(0); restClient.close(); diff --git a/java-client/src/test/java/co/elastic/clients/util/DateTimeTest.java b/java-client/src/test/java/co/elastic/clients/util/DateTimeTest.java index da0b1f3cf..593978adf 100644 --- a/java-client/src/test/java/co/elastic/clients/util/DateTimeTest.java +++ b/java-client/src/test/java/co/elastic/clients/util/DateTimeTest.java @@ -20,7 +20,7 @@ package co.elastic.clients.util; import co.elastic.clients.elasticsearch.model.ModelTestCase; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.time.Instant; import java.time.ZonedDateTime;