### Question:
Orchestrator { public void sendFileToController(String command, File file) throws Exception { logDebug(MODULE_NAME, "Start send file to Controller"); InputStream inputStream = new FileInputStream(file); MultipartEntityBuilder builder = MultipartEntityBuilder.create(); builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE); builder.addBinaryBody("upstream", inputStream, ContentType.create("application/zip"), file.getName()); HttpEntity entity = builder.build(); getJsonObject(null, RequestType.PUT, entity, createUri(command)); logDebug(MODULE_NAME, "Finished send file to Controller"); } Orchestrator(); boolean ping(); JsonObject provision(String key); JsonObject request(String command, RequestType requestType, Map<String, Object> queryParams, JsonObject json); void sendFileToController(String command, File file); void update();  }### Answer:
@Test public void testSendFileToController() { try { orchestrator.sendFileToController("strace", file); PowerMockito.verifyPrivate(orchestrator).invoke("getJsonObject", Mockito.eq(null), Mockito.eq(RequestType.PUT), Mockito.eq(httpEntity), Mockito.any()); } catch (Exception e) { fail("This should not happen"); } }
@Test (expected = Exception.class) public void throwsExceptionSendFileToController() throws Exception{ PowerMockito.doThrow(mock(Exception.class)).when(httpClients).execute(Mockito.any()); orchestrator.sendFileToController("strace", file); PowerMockito.verifyPrivate(orchestrator).invoke("getJsonObject", Mockito.eq(null), Mockito.eq(RequestType.PUT), Mockito.eq(httpEntity), Mockito.any()); }