diff --git a/springwolf-add-ons/springwolf-json-schema/src/test/java/io/github/springwolf/addons/json_schema/JsonSchemaGeneratorTest.java b/springwolf-add-ons/springwolf-json-schema/src/test/java/io/github/springwolf/addons/json_schema/JsonSchemaGeneratorTest.java index 0be03698b..89a881d58 100644 --- a/springwolf-add-ons/springwolf-json-schema/src/test/java/io/github/springwolf/addons/json_schema/JsonSchemaGeneratorTest.java +++ b/springwolf-add-ons/springwolf-json-schema/src/test/java/io/github/springwolf/addons/json_schema/JsonSchemaGeneratorTest.java @@ -83,25 +83,25 @@ public static Stream validateJsonSchemaTest() { // types Arguments.of( "{\"type\":\"number\",\"$schema\":\"https://json-schema.org/draft-04/schema#\"}", - (Supplier) NumberSchema::new), + (Supplier>) NumberSchema::new), Arguments.of( "{\"type\":\"string\",\"$schema\":\"https://json-schema.org/draft-04/schema#\"}", - (Supplier) StringSchema::new), + (Supplier>) StringSchema::new), Arguments.of( "{\"type\":\"array\",\"$schema\":\"https://json-schema.org/draft-04/schema#\"}", - (Supplier) ArraySchema::new), + (Supplier>) ArraySchema::new), Arguments.of( "{\"type\":\"boolean\",\"$schema\":\"https://json-schema.org/draft-04/schema#\"}", - (Supplier) BooleanSchema::new), + (Supplier>) BooleanSchema::new), Arguments.of( "{\"format\":\"email\",\"type\":\"string\",\"$schema\":\"https://json-schema.org/draft-04/schema#\"}", - (Supplier) EmailSchema::new), + (Supplier>) EmailSchema::new), Arguments.of( "{\"type\":\"object\",\"$schema\":\"https://json-schema.org/draft-04/schema#\"}", - (Supplier) MapSchema::new), + (Supplier>) MapSchema::new), Arguments.of( "{\"properties\": { \"id\": {\"type\": \"number\"}},\"type\":\"object\",\"$schema\":\"https://json-schema.org/draft-04/schema#\"}", - (Supplier) () -> { + (Supplier>) () -> { ObjectSchema schema = new ObjectSchema(); schema.setProperties(Map.of("id", new NumberSchema())); return schema; @@ -109,42 +109,42 @@ public static Stream validateJsonSchemaTest() { // fields Arguments.of( "{\"anyOf\": [{\"type\": \"number\"}],\"type\":\"object\",\"$schema\":\"https://json-schema.org/draft-04/schema#\"}", - (Supplier) () -> { + (Supplier>) () -> { ObjectSchema schema = new ObjectSchema(); schema.setAnyOf(List.of(new NumberSchema())); return schema; }), Arguments.of( "{\"allOf\": [{\"type\": \"number\"}],\"type\":\"object\",\"$schema\":\"https://json-schema.org/draft-04/schema#\"}", - (Supplier) () -> { + (Supplier>) () -> { ObjectSchema schema = new ObjectSchema(); schema.setAllOf(List.of(new NumberSchema())); return schema; }), Arguments.of( "{\"const\": \"test\",\"type\":\"string\",\"$schema\":\"https://json-schema.org/draft-04/schema#\"}", - (Supplier) () -> { + (Supplier>) () -> { StringSchema schema = new StringSchema(); schema.setConst("test"); return schema; }), Arguments.of( "{\"description\": \"test\",\"type\":\"string\",\"$schema\":\"https://json-schema.org/draft-04/schema#\"}", - (Supplier) () -> { + (Supplier>) () -> { StringSchema schema = new StringSchema(); schema.setDescription("test"); return schema; }), Arguments.of( "{\"enum\": [\"test\", \"value2\"],\"type\":\"string\",\"$schema\":\"https://json-schema.org/draft-04/schema#\"}", - (Supplier) () -> { + (Supplier>) () -> { StringSchema schema = new StringSchema(); schema.setEnum(List.of("test", "value2")); return schema; }), Arguments.of( "{\"enum\": [\"test\", \"value2\"],\"type\":\"string\",\"$schema\":\"https://json-schema.org/draft-04/schema#\"}", - (Supplier) () -> { + (Supplier>) () -> { StringSchema schema = new StringSchema(); schema.setEnum(List.of("test", "value2")); schema.setNullable(true); @@ -152,7 +152,7 @@ public static Stream validateJsonSchemaTest() { }), Arguments.of( "{\"exclusiveMinimum\": 1,\"exclusiveMaximum\": 10,\"type\":\"number\",\"$schema\":\"https://json-schema.org/draft-04/schema#\"}", - (Supplier) () -> { + (Supplier>) () -> { NumberSchema schema = new NumberSchema(); schema.setExclusiveMinimumValue(new BigDecimal(1)); schema.setExclusiveMaximumValue(new BigDecimal(10)); @@ -160,21 +160,21 @@ public static Stream validateJsonSchemaTest() { }), Arguments.of( "{\"format\": \"test\",\"type\":\"string\",\"$schema\":\"https://json-schema.org/draft-04/schema#\"}", - (Supplier) () -> { + (Supplier>) () -> { StringSchema schema = new StringSchema(); schema.setFormat("test"); return schema; }), Arguments.of( "{\"items\": {\"type\":\"number\"},\"type\":\"array\",\"$schema\":\"https://json-schema.org/draft-04/schema#\"}", - (Supplier) () -> { + (Supplier>) () -> { ArraySchema schema = new ArraySchema(); schema.setItems(new NumberSchema()); return schema; }), Arguments.of( "{\"maximum\": 10,\"minimum\": 1,\"type\":\"number\",\"$schema\":\"https://json-schema.org/draft-04/schema#\"}", - (Supplier) () -> { + (Supplier>) () -> { NumberSchema schema = new NumberSchema(); schema.setMaximum(new BigDecimal(10)); schema.setMinimum(new BigDecimal(1)); @@ -182,7 +182,7 @@ public static Stream validateJsonSchemaTest() { }), Arguments.of( "{\"maxItems\": 10,\"minItems\": 1,\"type\":\"array\",\"$schema\":\"https://json-schema.org/draft-04/schema#\"}", - (Supplier) () -> { + (Supplier>) () -> { ArraySchema schema = new ArraySchema(); schema.setMaxItems(10); schema.setMinItems(1); @@ -190,7 +190,7 @@ public static Stream validateJsonSchemaTest() { }), Arguments.of( "{\"maxLength\": 10,\"minLength\": 1,\"type\":\"string\",\"$schema\":\"https://json-schema.org/draft-04/schema#\"}", - (Supplier) () -> { + (Supplier>) () -> { StringSchema schema = new StringSchema(); schema.setMaxLength(10); schema.setMinLength(1); @@ -198,51 +198,51 @@ public static Stream validateJsonSchemaTest() { }), Arguments.of( "{\"multipleOf\": 10,\"type\":\"number\",\"$schema\":\"https://json-schema.org/draft-04/schema#\"}", - (Supplier) () -> { + (Supplier>) () -> { NumberSchema schema = new NumberSchema(); schema.setMultipleOf(new BigDecimal(10)); return schema; }), Arguments.of( "{\"not\": {\"type\":\"number\"},\"type\":\"object\",\"$schema\":\"https://json-schema.org/draft-04/schema#\"}", - (Supplier) () -> { + (Supplier>) () -> { ObjectSchema schema = new ObjectSchema(); schema.setNot(new NumberSchema()); return schema; }), Arguments.of( "{\"oneOf\": [{\"type\": \"number\"}],\"type\":\"object\",\"$schema\":\"https://json-schema.org/draft-04/schema#\"}", - (Supplier) () -> { + (Supplier>) () -> { ObjectSchema schema = new ObjectSchema(); schema.setOneOf(List.of(new NumberSchema())); return schema; }), Arguments.of( "{\"pattern\":\"test\",\"type\":\"object\",\"$schema\":\"https://json-schema.org/draft-04/schema#\"}", - (Supplier) () -> { + (Supplier>) () -> { ObjectSchema schema = new ObjectSchema(); schema.setPattern("test"); return schema; }), Arguments.of( "{\"properties\": {\"field1\": {\"type\": \"number\"}, \"field2\": {\"type\": \"string\"}}, \"required\":[\"field1\"],\"type\":\"object\",\"$schema\":\"https://json-schema.org/draft-04/schema#\"}", - (Supplier) () -> { + (Supplier>) () -> { ObjectSchema schema = new ObjectSchema(); schema.setProperties( - new TreeMap(Map.of("field1", new NumberSchema(), "field2", new StringSchema()))); + new TreeMap<>(Map.of("field1", new NumberSchema(), "field2", new StringSchema()))); schema.setRequired(List.of("field1")); return schema; }), Arguments.of( "{\"title\": \"test\",\"type\":\"object\",\"$schema\":\"https://json-schema.org/draft-04/schema#\"}", - (Supplier) () -> { + (Supplier>) () -> { ObjectSchema schema = new ObjectSchema(); schema.setTitle("test"); return schema; }), Arguments.of( "{\"type\":\"array\",\"uniqueItems\": true,\"$schema\":\"https://json-schema.org/draft-04/schema#\"}", - (Supplier) () -> { + (Supplier>) () -> { ArraySchema schema = new ArraySchema(); schema.setUniqueItems(true); return schema; @@ -250,7 +250,7 @@ public static Stream validateJsonSchemaTest() { // ref Arguments.of( "{\"properties\":{\"field\": {\"type\":\"string\"}}, \"type\":\"object\",\"$schema\":\"https://json-schema.org/draft-04/schema#\"}", - (Supplier) () -> { + (Supplier>) () -> { ObjectSchema refField = new ObjectSchema(); refField.set$ref("StringRef"); @@ -260,7 +260,7 @@ public static Stream validateJsonSchemaTest() { }), Arguments.of( "{\"properties\":{\"field\":{\"properties\":{\"pingfield\":{\"properties\":{\"pongField\":{}},\"type\":\"object\"}},\"type\":\"object\"}},\"type\":\"object\",\"$schema\":\"https://json-schema.org/draft-04/schema#\"}", - (Supplier) () -> { + (Supplier>) () -> { ObjectSchema refField = new ObjectSchema(); refField.set$ref("PingSchema"); diff --git a/springwolf-examples/springwolf-jms-example/src/test/java/io/github/springwolf/examples/jms/JmsTestContainerExtension.java b/springwolf-examples/springwolf-jms-example/src/test/java/io/github/springwolf/examples/jms/JmsTestContainerExtension.java index 34783c997..839722889 100644 --- a/springwolf-examples/springwolf-jms-example/src/test/java/io/github/springwolf/examples/jms/JmsTestContainerExtension.java +++ b/springwolf-examples/springwolf-jms-example/src/test/java/io/github/springwolf/examples/jms/JmsTestContainerExtension.java @@ -12,7 +12,7 @@ * JUnit5 extension to start the localstack testcontainers once * and keep it running until all test classes have been completed. */ -public class JmsTestContainerExtension implements BeforeAllCallback, ExtensionContext.Store.CloseableResource { +public class JmsTestContainerExtension implements BeforeAllCallback, AutoCloseable { private static volatile boolean started = false; diff --git a/springwolf-examples/springwolf-sns-example/src/test/java/io/github/springwolf/examples/sns/SnsTestContainerExtension.java b/springwolf-examples/springwolf-sns-example/src/test/java/io/github/springwolf/examples/sns/SnsTestContainerExtension.java index 152050ddf..363735674 100644 --- a/springwolf-examples/springwolf-sns-example/src/test/java/io/github/springwolf/examples/sns/SnsTestContainerExtension.java +++ b/springwolf-examples/springwolf-sns-example/src/test/java/io/github/springwolf/examples/sns/SnsTestContainerExtension.java @@ -16,7 +16,7 @@ * JUnit5 extension to start the localstack testcontainers once * and keep it running until all test classes have been completed. */ -public class SnsTestContainerExtension implements BeforeAllCallback, ExtensionContext.Store.CloseableResource { +public class SnsTestContainerExtension implements BeforeAllCallback, AutoCloseable { private static volatile boolean started = false; @@ -45,7 +45,7 @@ private static void beforeAllOnce() throws IOException, InterruptedException { } @Override - public void close() throws Throwable { + public void close() { localStack.stop(); } diff --git a/springwolf-examples/springwolf-sqs-example/src/test/java/io/github/springwolf/examples/sqs/SqsTestContainerExtension.java b/springwolf-examples/springwolf-sqs-example/src/test/java/io/github/springwolf/examples/sqs/SqsTestContainerExtension.java index 76284a565..28b4ce52b 100644 --- a/springwolf-examples/springwolf-sqs-example/src/test/java/io/github/springwolf/examples/sqs/SqsTestContainerExtension.java +++ b/springwolf-examples/springwolf-sqs-example/src/test/java/io/github/springwolf/examples/sqs/SqsTestContainerExtension.java @@ -16,7 +16,7 @@ * JUnit5 extension to start the localstack testcontainers once * and keep it running until all test classes have been completed. */ -public class SqsTestContainerExtension implements BeforeAllCallback, ExtensionContext.Store.CloseableResource { +public class SqsTestContainerExtension implements BeforeAllCallback, AutoCloseable { private static volatile boolean started = false; @@ -45,7 +45,7 @@ private static void beforeAllOnce() throws IOException, InterruptedException { } @Override - public void close() throws Throwable { + public void close() { localStack.stop(); } diff --git a/springwolf-plugins/springwolf-sns-plugin/src/test/java/io/github/springwolf/plugins/sns/producer/SpringwolfSnsProducerTest.java b/springwolf-plugins/springwolf-sns-plugin/src/test/java/io/github/springwolf/plugins/sns/producer/SpringwolfSnsProducerTest.java index 1af612cb1..79ed35e1e 100644 --- a/springwolf-plugins/springwolf-sns-plugin/src/test/java/io/github/springwolf/plugins/sns/producer/SpringwolfSnsProducerTest.java +++ b/springwolf-plugins/springwolf-sns-plugin/src/test/java/io/github/springwolf/plugins/sns/producer/SpringwolfSnsProducerTest.java @@ -22,6 +22,8 @@ class SpringwolfSnsProducerTest { private SpringwolfSnsProducer springwolfSnsProducer; private SnsTemplate template; + + @SuppressWarnings("unchecked") private final ArgumentCaptor> messageCaptor = ArgumentCaptor.forClass(Message.class); @BeforeEach diff --git a/springwolf-plugins/springwolf-sqs-plugin/src/test/java/io/github/springwolf/plugins/sqs/producer/SpringwolfSqsProducerTest.java b/springwolf-plugins/springwolf-sqs-plugin/src/test/java/io/github/springwolf/plugins/sqs/producer/SpringwolfSqsProducerTest.java index 622ec9656..912fcfb04 100644 --- a/springwolf-plugins/springwolf-sqs-plugin/src/test/java/io/github/springwolf/plugins/sqs/producer/SpringwolfSqsProducerTest.java +++ b/springwolf-plugins/springwolf-sqs-plugin/src/test/java/io/github/springwolf/plugins/sqs/producer/SpringwolfSqsProducerTest.java @@ -22,6 +22,8 @@ class SpringwolfSqsProducerTest { private SpringwolfSqsProducer springwolfSqsProducer; private SqsTemplate template; + + @SuppressWarnings("unchecked") private final ArgumentCaptor> messageCaptor = ArgumentCaptor.forClass(Message.class); @BeforeEach