MCPcopy Index your code
hub / github.com/OpenFeign/feign / encodes

Method encodes

json/src/test/java/feign/json/JsonCodecTest.java:72–89  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

70 }
71
72 @Test
73 void encodes() {
74 JSONObject contributor = new JSONObject();
75 contributor.put("login", "radio-rogal");
76 contributor.put("contributions", 0);
77 mockClient.ok(
78 HttpMethod.POST,
79 "/repos/openfeign/feign/contributors",
80 "{\"login\":\"radio-rogal\",\"contributions\":0}");
81 JSONObject response = github.create("openfeign", "feign", contributor);
82 Request request = mockClient.verifyOne(HttpMethod.POST, "/repos/openfeign/feign/contributors");
83 assertThat(request.body()).isNotNull();
84 String json = new String(request.body());
85 assertThat(json).contains("\"login\":\"radio-rogal\"");
86 assertThat(json).contains("\"contributions\":0");
87 assertThat(response.getString("login")).isEqualTo("radio-rogal");
88 assertThat(response.getInt("contributions")).isEqualTo(0);
89 }
90}

Callers

nothing calls this directly

Calls 6

bodyMethod · 0.95
okMethod · 0.80
verifyOneMethod · 0.80
putMethod · 0.65
createMethod · 0.65
assertThatMethod · 0.45

Tested by

no test coverage detected