Add another header unit test

pull/30/head
Richard Körber 2016-07-27 23:09:42 +02:00
parent e946e6397c
commit ef7070a3b6
1 changed files with 15 additions and 0 deletions

View File

@ -26,6 +26,7 @@ import java.net.URI;
import java.net.URL; import java.net.URL;
import java.security.cert.X509Certificate; import java.security.cert.X509Certificate;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -213,6 +214,20 @@ public class DefaultConnectionTest {
} }
} }
/**
* Test that no link headers are properly handled.
*/
@Test
public void testGetNoLink() {
Map<String, List<String>> headers = Collections.emptyMap();
when(mockUrlConnection.getHeaderFields()).thenReturn(headers);
try (DefaultConnection conn = new DefaultConnection(mockHttpConnection)) {
conn.conn = mockUrlConnection;
assertThat(conn.getLinks("something"), is(nullValue()));
}
}
/** /**
* Test that no Location header returns {@code null}. * Test that no Location header returns {@code null}.
*/ */