BAEL-722 Intro to JSONassert (#1460)

* yasin.bhojawala@gmail.com

Evaluation article on Different Types of Bean Injection in Spring

* Revert "yasin.bhojawala@gmail.com"

This reverts commit 963cc51a7a15b75b550108fe4e198cd65a274032.

* Fixing compilation error and removing unused import

* Introduction to Java9 StackWalking API - yasin.bhojawala@gmail.com

Code examples for the article "Introduction to Java9 StackWalking API"

* BAEL-608 Introduction to Java9 StackWalking API

* BAEL-608 Introduction to Java9 StackWalking API

changing the test names to BDD style

* BAEL-608 Introduction to Java9 StackWalking API

correcting the typo

* BAEL-608 Introduction to Java9 StackWalking API

improving method names

* BAEL-608 Introduction to Java9 StackWalking API

test method names improvements

* BAEL-718 Quick intro to javatuples

* merging pom from master

* BAEL-722 Intro to JSONassert

* BAEL-722 Intro to JSONassert

Updated to 1.5.0
This commit is contained in:
Yasin 2017-03-20 23:43:42 +05:30 committed by maibin
parent b95a014c8a
commit 9c755ee39c
2 changed files with 15 additions and 1 deletions

View File

@ -77,7 +77,7 @@
<javatuples.version>1.2</javatuples.version>
<javaassist.version>3.21.0-GA</javaassist.version>
<assertj.version>3.6.2</assertj.version>
<jsonassert.version>1.4.0</jsonassert.version>
<jsonassert.version>1.5.0</jsonassert.version>
</properties>
</project>

View File

@ -1,5 +1,8 @@
package com.baeldung.jsonassert;
import static org.assertj.core.api.Assertions.assertThat;
import org.json.JSONException;
import org.json.JSONObject;
import org.junit.Test;
@ -64,6 +67,17 @@ public class JsonAssertTest {
JSONAssert.assertEquals("{id:1,name:\"Juergen\", address:{city:\"Hollywood\", "
+ "state:\"LA\", zip:91601}}", result, false);
}
@Test
public void whenMessageUsedInAssertion_thenDisplayMessageOnFailure() throws JSONException {
String actual = "{id:123,name:\"John\"}";
String failureMessage = "Only one field is expected: name";
try {
JSONAssert.assertEquals(failureMessage, "{name:\"John\"}", actual, JSONCompareMode.STRICT);
} catch (AssertionError ae) {
assertThat(ae.getMessage()).containsIgnoringCase(failureMessage);
}
}
@Test
public void givenArray_whenComparing_thenOrderMustMatchForStrict() throws JSONException {