Skip to content

Commit

Permalink
incidental style cleanup of 3 test classes
Browse files Browse the repository at this point in the history
  • Loading branch information
ndushay committed Jun 1, 2017
1 parent 0653894 commit b5600aa
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 15 deletions.
13 changes: 1 addition & 12 deletions test/edu/stanford/dlss/was/TestDownloadResponseHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,37 +15,26 @@
import org.junit.*;
import static org.junit.Assert.*;
import org.mockito.*;
import org.mockito.Mockito.*;
import org.mockito.invocation.*;
import org.mockito.stubbing.*;



public class TestDownloadResponseHandler {
private static final char SEP = File.separatorChar;
private static final String OUTPUT_DIRECTORY = new String("test" + SEP + "tmp");
private static final String OUTPUT_FILE_PATH = new String(OUTPUT_DIRECTORY + SEP + "testDownloadResponseHandler.output");
private static final StatusLine VALID_STATUS_LINE = new BasicStatusLine(new ProtocolVersion("HTTP 1/1", 1, 1), 200, "OK");

private void writeToFile() throws IOException {
new File(OUTPUT_FILE_PATH).createNewFile();
return;
}


@Before
public void setUp() {
new File(OUTPUT_DIRECTORY).mkdir();
}


@After
public void tearDown() {
new File(OUTPUT_FILE_PATH).delete();
new File(OUTPUT_DIRECTORY).delete();
}


@Test(expected = ClientProtocolException.class)
public void nullEntityThrowsException() throws ClientProtocolException, HttpResponseException, IOException {
DownloadResponseHandler handler = new DownloadResponseHandler("/dev/null");
Expand All @@ -56,7 +45,6 @@ public void nullEntityThrowsException() throws ClientProtocolException, HttpResp
handler.handleResponse(mockResponse);
}


@Test
public void validResponseDownloadsFile() throws ClientProtocolException, HttpResponseException, IOException {
DownloadResponseHandler handler = new DownloadResponseHandler(OUTPUT_FILE_PATH);
Expand All @@ -66,6 +54,7 @@ public void validResponseDownloadsFile() throws ClientProtocolException, HttpRes
Mockito.when(mockResponse.getStatusLine()).thenReturn(VALID_STATUS_LINE);

Mockito.doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) throws IOException {
new File(OUTPUT_FILE_PATH).createNewFile();
return null;
Expand Down
2 changes: 0 additions & 2 deletions test/edu/stanford/dlss/was/TestJsonResponseHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import org.junit.*;
import static org.junit.Assert.*;
import org.mockito.*;
import org.mockito.Mockito.*;

public class TestJsonResponseHandler {

Expand All @@ -33,7 +32,6 @@ public void nullEntityThrowsException() throws ClientProtocolException, HttpResp
handler.handleResponse(mockResponse);
}


@Test
public void validResponseParsesCorrectly() throws ClientProtocolException, HttpResponseException, IOException {
JsonResponseHandler handler = new JsonResponseHandler();
Expand Down
1 change: 0 additions & 1 deletion test/edu/stanford/dlss/was/TestWasapiClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;

import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import org.junit.*;
import static org.mockito.Mockito.*;
Expand Down

0 comments on commit b5600aa

Please sign in to comment.