Skip to content

Commit

Permalink
Fixed flaky tests in feign.json.JsonEncoderTest (#1538)
Browse files Browse the repository at this point in the history
fixed format
  • Loading branch information
Augustine-C authored Nov 15, 2021
1 parent ca9aef9 commit 480dc80
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 6 additions & 0 deletions json/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.skyscreamer</groupId>
<artifactId>jsonassert</artifactId>
<version>1.5.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>feign-mock</artifactId>
Expand Down
7 changes: 5 additions & 2 deletions json/src/test/java/feign/json/JsonEncoderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.json.JSONObject;
import org.junit.Before;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
import java.util.Date;
import static feign.Util.UTF_8;
import static org.junit.Assert.*;
Expand All @@ -43,13 +44,15 @@ public void setUp() {
@Test
public void encodesArray() {
new JsonEncoder().encode(jsonArray, JSONArray.class, requestTemplate);
assertEquals("[{\"a\":\"b\",\"c\":1},123]", new String(requestTemplate.body(), UTF_8));
JSONAssert.assertEquals("[{\"a\":\"b\",\"c\":1},123]",
new String(requestTemplate.body(), UTF_8), false);
}

@Test
public void encodesObject() {
new JsonEncoder().encode(jsonObject, JSONObject.class, requestTemplate);
assertEquals("{\"a\":\"b\",\"c\":1}", new String(requestTemplate.body(), UTF_8));
JSONAssert.assertEquals("{\"a\":\"b\",\"c\":1}", new String(requestTemplate.body(), UTF_8),
false);
}

@Test
Expand Down

0 comments on commit 480dc80

Please sign in to comment.