Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed flaky tests in feign.json.JsonEncoderTest #1538

Merged
merged 1 commit into from
Nov 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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