对于这样的函数,如何进行junit测试?
try {
HttpPost httppost = new HttpPost("http://tbird2:80/uws/archive/QueryDicom");
httppost.addHeader("content-type", "application/xml");
String quoteRequestPayLoad = DMUtils.getQueryDicomXmlPayload(studyInstanceUUID);
StringEntity userEntity = new StringEntity(quoteRequestPayLoad);
httppost.setEntity(userEntity);
HttpResponse httpresponse = httpClient.execute(httppost);
HttpEntity entity = httpresponse.getEntity();
String responseString = EntityUtils.toString(entity, "UTF-8");
List<String> SOPInstanceUUIDs = DMUtils.parseSopIdFromQuteResponse(responseString);
SOPInstanceUUIDs.forEach(
SOPInstanceUUID -> {
try {
// remove " first and last char as this is coming from xml "e
SOPInstanceUUID = SOPInstanceUUID.substring(1, SOPInstanceUUID.length() - 1);
dicomObjectList.add(fetchDicomObjectFromSOPInstanceUUID(SOPInstanceUUID));
} catch (Exception e) {
e.printStackTrace();
}
});
return dicomObjectList;}
如何使用apache?我想不出一个开门红的主意。
暂无答案!
目前还没有任何答案,快来回答吧!