* RtReleaseAsset can create a patch request.
* @throws Exception If a problem occurs.
*/
@Test
public void patchesAsset() throws Exception {
final MkContainer container = new MkGrizzlyContainer().next(
new MkAnswer.Simple(HttpURLConnection.HTTP_OK, "")
).start();
final RtReleaseAsset asset = new RtReleaseAsset(
new ApacheRequest(container.home()),
release(),
2
);
try {
final JsonObject json = Json.createObjectBuilder()
.add("name", "hello").build();
asset.patch(json);
final MkQuery query = container.take();
MatcherAssert.assertThat(
query.method(), Matchers.equalTo(Request.PATCH)
);
MatcherAssert.assertThat(
query.body(),
Matchers.containsString("{\"name\":\"hello\"}")
);
MatcherAssert.assertThat(
query.uri().toString(),
Matchers.endsWith("/repos/john/test/releases/assets/2")
);
} finally {
container.stop();
}
}