### Question:
JackrabbitHotfolder extends ServerHotfolder implements
		Hotfolder, Serializable { @Override public void upload(URI fromLocal, URI toRemote) throws IOException { File sourceFile = new File(fromLocal); String targetUri = toRemote.toString(); if (!fileAccess.fileExists(sourceFile)) { log.error("File " + sourceFile + " doesn't exist."); throw new IllegalArgumentException("File " + sourceFile + " doesn't exist."); } PutMethod putMethod = new PutMethod(targetUri); String mimeType = URLConnection.guessContentTypeFromName(sourceFile.getPath()); putMethod.setRequestEntity(new FileRequestEntity(sourceFile, mimeType)); try { execute(putMethod); } finally { putMethod.releaseConnection(); } }  void configureConnection(String serverUrl, String username, String password); @Override void upload(URI fromLocal, URI toRemote); @Override void download(URI fromRemote, URI toLocal); @Override void delete(URI uri); @Override boolean exists(URI uri); @Override long getUsedSpace(URI uri); @Override byte[] getResponse(URI uri);  }### Answer:
@Test public void shouldUploadToRemote() throws IOException, URISyntaxException { jackrabbitSut.upload(new URI("file:/test.jpg"), new URI("http: verify(httpClientMock).executeMethod(any(PutMethod.class)); }
@Test(expected=IllegalArgumentException.class) public void shouldFailWithNotExistingFile() throws IOException, URISyntaxException { when(fileAccessMock.fileExists(any(File.class))).thenReturn(false); jackrabbitSut.upload(new URI("file:/test.jpg"), new URI("http: }
@Test(expected=IllegalStateException.class) public void shouldFailWhenIllegalStatusCode() throws IOException, URISyntaxException { when(httpClientMock.executeMethod(any(HttpMethod.class))).thenReturn(403); jackrabbitSut.upload(new URI("file:/test.jpg"), new URI("http: }
@Test public void shouldIgnoreOneIllegalStatusCode() throws IOException, URISyntaxException { when(httpClientMock.executeMethod(any(HttpMethod.class))).thenReturn(403, 200); jackrabbitSut.upload(new URI("file:/test.jpg"), new URI("http: verify(httpClientMock, times(2)).executeMethod(any(PutMethod.class)); }