diff --git a/impl/src/test/java/org/eclipse/parsson/tests/JsonBuilderTest.java b/impl/src/test/java/org/eclipse/parsson/tests/JsonBuilderTest.java index c9bd7bc..3f15f42 100644 --- a/impl/src/test/java/org/eclipse/parsson/tests/JsonBuilderTest.java +++ b/impl/src/test/java/org/eclipse/parsson/tests/JsonBuilderTest.java @@ -101,7 +101,7 @@ static Map buildPersonAsMap() { person.put("lastName", "Smith"); person.put("age", 25); - Map address = Optional.of(new HashMap()).get(); + Map address = new HashMap<>(); address.put("streetAddress", "21 2nd Street"); address.put("city", "New York"); address.put("state", "NY"); diff --git a/impl/src/test/java/org/eclipse/parsson/tests/JsonGeneratorTest.java b/impl/src/test/java/org/eclipse/parsson/tests/JsonGeneratorTest.java index eca28b5..2b5e35f 100644 --- a/impl/src/test/java/org/eclipse/parsson/tests/JsonGeneratorTest.java +++ b/impl/src/test/java/org/eclipse/parsson/tests/JsonGeneratorTest.java @@ -499,9 +499,7 @@ void testGeneratorBuf() { @Test void testBufferPoolFeature() { final JsonParserTest.MyBufferPool bufferPool = new JsonParserTest.MyBufferPool(1024); - Map config = new HashMap() {{ - put(BufferPool.class.getName(), bufferPool); - }}; + Map config = Map.of(BufferPool.class.getName(), bufferPool); JsonGeneratorFactory factory = Json.createGeneratorFactory(config); JsonGenerator generator = factory.createGenerator(new StringWriter()); @@ -518,9 +516,7 @@ void testBufferSizes() { JsonBuilderFactory bf = Json.createBuilderFactory(null); for(int size=10; size < 1000; size++) { final JsonParserTest.MyBufferPool bufferPool = new JsonParserTest.MyBufferPool(size); - Map config = new HashMap() {{ - put(BufferPool.class.getName(), bufferPool); - }}; + Map config = Map.of(BufferPool.class.getName(), bufferPool); JsonGeneratorFactory gf = Json.createGeneratorFactory(config); StringBuilder sb = new StringBuilder(); diff --git a/impl/src/test/java/org/eclipse/parsson/tests/JsonParserTest.java b/impl/src/test/java/org/eclipse/parsson/tests/JsonParserTest.java index 5fba5cc..f009247 100644 --- a/impl/src/test/java/org/eclipse/parsson/tests/JsonParserTest.java +++ b/impl/src/test/java/org/eclipse/parsson/tests/JsonParserTest.java @@ -693,9 +693,7 @@ boolean isRecycleCalled() { @Test void testBufferPoolFeature() { final MyBufferPool bufferPool = new MyBufferPool(1024); - Map config = new HashMap() {{ - put(BufferPool.class.getName(), bufferPool); - }}; + Map config = Map.of(BufferPool.class.getName(), bufferPool); JsonParserFactory factory = Json.createParserFactory(config); try (JsonParser parser = factory.createParser(new StringReader("[]"))) { @@ -711,9 +709,7 @@ void testBufferSizes() { Random r = new Random(System.currentTimeMillis()); for(int size=100; size < 1000; size++) { final MyBufferPool bufferPool = new MyBufferPool(size); - Map config = new HashMap() {{ - put(BufferPool.class.getName(), bufferPool); - }}; + Map config = Map.of(BufferPool.class.getName(), bufferPool); JsonParserFactory factory = Json.createParserFactory(config); StringBuilder sb = new StringBuilder(); @@ -790,9 +786,7 @@ void testIntegerUsingStandardBuffer() throws Throwable { void testStringUsingBuffers() throws Throwable { for(int size=20; size < 500; size++) { final MyBufferPool bufferPool = new MyBufferPool(size); - Map config = new HashMap() {{ - put(BufferPool.class.getName(), bufferPool); - }}; + Map config = Map.of(BufferPool.class.getName(), bufferPool); JsonParserFactory factory = Json.createParserFactory(config); StringBuilder sb = new StringBuilder(); diff --git a/impl/src/test/java/org/eclipse/parsson/tests/JsonReaderTest.java b/impl/src/test/java/org/eclipse/parsson/tests/JsonReaderTest.java index c8ed5a1..fc9882a 100644 --- a/impl/src/test/java/org/eclipse/parsson/tests/JsonReaderTest.java +++ b/impl/src/test/java/org/eclipse/parsson/tests/JsonReaderTest.java @@ -254,9 +254,7 @@ void testDuplicateKeysLast() { void testEmptyStringUsingBuffers() throws Throwable { for(int size=20; size < 500; size++) { final JsonParserTest.MyBufferPool bufferPool = new JsonParserTest.MyBufferPool(size); - Map config = new HashMap() {{ - put(BufferPool.class.getName(), bufferPool); - }}; + Map config = Map.of(BufferPool.class.getName(), bufferPool); JsonReaderFactory factory = Json.createReaderFactory(config); StringBuilder sb = new StringBuilder();