| 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 | } |