### Question:
Server2ControllerSegmentUploader implements SegmentUploader { @Override public URI uploadSegment(File segmentFile, LLCSegmentName segmentName) { SegmentCompletionProtocol.Response response = uploadSegmentToController(segmentFile); if (response.getStatus() == SegmentCompletionProtocol.ControllerResponseStatus.UPLOAD_SUCCESS) { try { return new URI(response.getSegmentLocation()); } catch (URISyntaxException e) { _segmentLogger.error("Error in segment location format: ", e); } } return null; } Server2ControllerSegmentUploader(Logger segmentLogger, FileUploadDownloadClient fileUploadDownloadClient,
      String controllerSegmentUploadCommitUrl, String segmentName, int segmentUploadRequestTimeoutMs,
      ServerMetrics serverMetrics); @Override URI uploadSegment(File segmentFile,  LLCSegmentName segmentName); SegmentCompletionProtocol.Response uploadSegmentToController(File segmentFile);  }### Answer:
@Test public void testUploadSuccess() throws URISyntaxException { Server2ControllerSegmentUploader uploader = new Server2ControllerSegmentUploader(_logger, _fileUploadDownloadClient, GOOD_CONTROLLER_VIP, "segmentName", 10000, mock(ServerMetrics.class)); URI segmentURI = uploader.uploadSegment(_file, _llcSegmentName); Assert.assertEquals(segmentURI.toString(), SEGMENT_LOCATION); }
@Test public void testUploadFailure() throws URISyntaxException { Server2ControllerSegmentUploader uploader = new Server2ControllerSegmentUploader(_logger, _fileUploadDownloadClient, BAD_CONTROLLER_VIP, "segmentName", 10000, mock(ServerMetrics.class)); URI segmentURI = uploader.uploadSegment(_file, _llcSegmentName); Assert.assertNull(segmentURI); }