### Question:
RequestServiceImpl implements JdbcRequestService { @Override public ApiResponse apply(JdbcExecutor sender, String user, String password) { return apply(sender, JdbcJsonBuilder.buildAuthJson(user, password, "")); }  @Override ApiResponse apply(JdbcExecutor sender, String user, String password); @Override @SuppressWarnings("unchecked") ApiResponse apply(JdbcExecutor sender, final String requestJson); @Override ApiResponse applyWithRetry(JdbcExecutor sender, String user, String password, int retryTime); @Override @SuppressWarnings("unchecked") ApiResponse applyWithRetry(JdbcExecutor sender, String requestJson, int retryTime);  }### Answer:
@Test public void apply() { JdbcExecutor mockJdbcExecutor = PowerMock.createMock(JdbcExecutor.class); ApiResponse mockApiResponse = PowerMock.createMock(ApiResponse.class); EasyMock.expect(mockApiResponse.isError()).andReturn(false).anyTimes(); SwiftResponse mockRpcResponse = PowerMock.createMock(SwiftResponse.class); EasyMock.expect(mockRpcResponse.getResult()).andReturn(mockApiResponse).anyTimes(); EasyMock.expect(mockJdbcExecutor.send(EasyMock.notNull(SwiftRequest.class))).andReturn(mockRpcResponse).anyTimes(); PowerMock.replayAll(); ApiResponse response = new RequestServiceImpl().apply(mockJdbcExecutor, "user", "pass"); assertFalse(response.isError()); PowerMock.verifyAll(); }
@Test public void apply2() { String jsonString = "{\"database\":cube,\"requestType\":\"SQL\",\"auth\":\"authCode\",\"requestId\":\"93eceaf1-4e47-40a1-84e9-814404eb7ad5\",\"sql\":\"select * from tableA\"}"; JdbcExecutor mockJdbcExecutor = PowerMock.createMock(JdbcExecutor.class); ApiResponse mockApiResponse = PowerMock.createMock(ApiResponse.class); EasyMock.expect(mockApiResponse.isError()).andReturn(false).anyTimes(); SwiftResponse mockRpcResponse = PowerMock.createMock(SwiftResponse.class); EasyMock.expect(mockRpcResponse.getResult()).andReturn(mockApiResponse).anyTimes(); EasyMock.expect(mockJdbcExecutor.send(EasyMock.notNull(SwiftRequest.class))).andReturn(mockRpcResponse).anyTimes(); PowerMock.replayAll(); ApiResponse response = new RequestServiceImpl().apply(mockJdbcExecutor, jsonString); assertFalse(response.isError()); PowerMock.verifyAll(); }