### Question:
PermalinkControllerImpl implements PermalinkController { @Override public String uploadFile(FilePayload payload, HttpServer server) throws IOException, URISyntaxException { String host = server.getHost(); StringBuilder builder = new StringBuilder(); builder.append(server.getProtocol()); builder.append(": builder.append(host); String hostUrl = builder.toString(); builder.append(getPermalinkUrl(host)); FileUploader uploader = payload.createUploader(server, builder.toString()); return hostUrl + uploader.upload(); } PermalinkControllerImpl(ServerListManager serverListManager, ServerSourceControllerManager controllerManager); @Override InputStream downloadFile(String fileUrl, HttpServer server); @Override String getPermalinkUrl(String host); @Override String uploadFile(FilePayload payload, HttpServer server);  }### Answer:
@Test public void testUploadStateFile() throws IOException, URISyntaxException { EasyMockSupport support = new EasyMockSupport(); ServerListManager serverListManager = createServerManager(support); ServerSourceControllerManager controllerManager = createManager(support); HttpServer server = createServerForUpload(support); support.replayAll(); PermalinkControllerImpl permalinker = new PermalinkControllerImpl(serverListManager, controllerManager); String permalinkUrl = permalinker.uploadFile(new SimpleFilePayload(ourTestFile), server); StringBuilder builder = new StringBuilder(); builder.append(ourProtocol); builder.append(": builder.append(ourHost); builder.append(ourDownloadUrl); assertEquals(builder.toString(), permalinkUrl); support.verifyAll(); }