diff --git a/json/README.md b/json/README.md index 0a4782cd86..73db055679 100644 --- a/json/README.md +++ b/json/README.md @@ -13,4 +13,4 @@ This module contains articles about JSON. - [Iterating Over an Instance of org.json.JSONObject](https://www.baeldung.com/jsonobject-iteration) - [Escape JSON String in Java](https://www.baeldung.com/java-json-escaping) - [Reducing JSON Data Size](https://www.baeldung.com/json-reduce-data-size) -- More Articles: [[next -->]](/json-2) +- More Articles: [[next -->]](../json-2) diff --git a/json/pom.xml b/json/pom.xml index 0d83f523b8..9b49f4cc7e 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -69,7 +69,7 @@ 1.4.1 1.0 1.0.1 - 20171018 + 20211205 2.8.5 1.1.2 diff --git a/json/src/test/java/com/baeldung/jsonjava/CookieIntegrationTest.java b/json/src/test/java/com/baeldung/jsonjava/CookieIntegrationTest.java index c1a3505bbc..4de5d8a21c 100644 --- a/json/src/test/java/com/baeldung/jsonjava/CookieIntegrationTest.java +++ b/json/src/test/java/com/baeldung/jsonjava/CookieIntegrationTest.java @@ -1,5 +1,6 @@ package com.baeldung.jsonjava; +import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.assertEquals; import org.json.Cookie; @@ -14,7 +15,7 @@ public class CookieIntegrationTest { assertEquals("{\"path\":\"/\",\"expires\":\"Thu, 18 Dec 2013 12:00:00 UTC\",\"name\":\"username\",\"value\":\"John Doe\"}", cookieJO.toString()); } - + @Test public void givenJSONObject_thenConvertToCookieString() { JSONObject cookieJO = new JSONObject(); @@ -22,8 +23,10 @@ public class CookieIntegrationTest { cookieJO.put("value", "John Doe"); cookieJO.put("expires", "Thu, 18 Dec 2013 12:00:00 UTC"); cookieJO.put("path", "/"); + String cookie = Cookie.toString(cookieJO); - assertEquals("username=John Doe;expires=Thu, 18 Dec 2013 12:00:00 UTC;path=/", cookie.toString()); + assertThat(cookie.split(";")) + .containsExactlyInAnyOrder("username=John Doe", "path=/", "expires=Thu, 18 Dec 2013 12:00:00 UTC"); } }