From ef7070a3b65408735db684f5e33fe5add4e8de5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20K=C3=B6rber?= Date: Wed, 27 Jul 2016 23:09:42 +0200 Subject: [PATCH] Add another header unit test --- .../acme4j/connector/DefaultConnectionTest.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/acme4j-client/src/test/java/org/shredzone/acme4j/connector/DefaultConnectionTest.java b/acme4j-client/src/test/java/org/shredzone/acme4j/connector/DefaultConnectionTest.java index 8c4806da..31076bda 100644 --- a/acme4j-client/src/test/java/org/shredzone/acme4j/connector/DefaultConnectionTest.java +++ b/acme4j-client/src/test/java/org/shredzone/acme4j/connector/DefaultConnectionTest.java @@ -26,6 +26,7 @@ import java.net.URI; import java.net.URL; import java.security.cert.X509Certificate; import java.util.Arrays; +import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.List; @@ -213,6 +214,20 @@ public class DefaultConnectionTest { } } + /** + * Test that no link headers are properly handled. + */ + @Test + public void testGetNoLink() { + Map> 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}. */