こんにちは私はjunitテストケースで渡す必要があるjsonリクエストを持っていますが、deleteはsetEntityメソッドをサポートしていません。リクエストをテストケースに渡すにはどうしたらいいですか?私は渡された値のデータをできるようにJSON値を渡す方法このjunitで削除メソッドのリクエストを渡す方法
@Test
public void testdeleteAltSite() throws ClientProtocolException, IOException {
String resultCode = "001";
String resultText = "Success";
String url = "http://localhost:8080/adminrest1/alternatesite";
HttpClient client = HttpClientBuilder.create().build();
HttpDelete delete = new HttpDelete(url);
// add header
delete.addHeader("Transaction-Id", "11");
delete.addHeader("content-type", "application/json");
LOG.info(url);
HttpResponse response = client.execute(delete);
byte[] buf = new byte[512];
InputStream is = response.getEntity().getContent();
int count = 0;
StringBuilder builder = new StringBuilder(1024);
while ((count = is.read(buf, 0, 512)) > 0) {
builder.append(new String(buf, 0, count));
}
String output = builder.toString();
System.out.println(output);
}`
ため
{
"userId":"AJudd",
"siteId":"131",
"alternateSiteId":"186"
}
MyTestにケースを通過する必要が JSON要求削除?