Merge pull request #11642 from hkhan/JAVA-9056-upgrade-json-java-lib
[JAVA-9056] Upgrade JSON-java lib version
This commit is contained in:
commit
d073a5ffb7
|
@ -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)
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
<everit.json.schema.version>1.4.1</everit.json.schema.version>
|
||||
<jsonb-api.version>1.0</jsonb-api.version>
|
||||
<yasson.version>1.0.1</yasson.version>
|
||||
<json.version>20171018</json.version>
|
||||
<json.version>20211205</json.version>
|
||||
<gson.version>2.8.5</gson.version>
|
||||
<javax.version>1.1.2</javax.version>
|
||||
</properties>
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue