From f04bfc068ba3d2100d68e80754903f7d43274527 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 13 Nov 2013 06:47:53 +0100 Subject: [PATCH] Increase coverage of default identity. --- .../sone/freenet/wot/DefaultIdentityTest.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/test/java/net/pterodactylus/sone/freenet/wot/DefaultIdentityTest.java b/src/test/java/net/pterodactylus/sone/freenet/wot/DefaultIdentityTest.java index 13ded53..1cd462c 100644 --- a/src/test/java/net/pterodactylus/sone/freenet/wot/DefaultIdentityTest.java +++ b/src/test/java/net/pterodactylus/sone/freenet/wot/DefaultIdentityTest.java @@ -24,12 +24,15 @@ import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.empty; import static org.hamcrest.Matchers.hasEntry; import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.not; import static org.hamcrest.Matchers.nullValue; import static org.hamcrest.collection.IsIterableContainingInOrder.contains; import static org.mockito.Mockito.mock; import java.util.Collections; +import net.pterodactylus.sone.Matchers; + import org.junit.Test; /** @@ -135,4 +138,16 @@ public class DefaultIdentityTest { assertThat(identity.hashCode(), is(identity2.hashCode())); } + @Test + public void nullDoesNotMatchAnIdentity() { + assertThat(identity, not(is((Object) null))); + } + + @Test + public void toStringContainsIdAndNickname() { + String identityString = identity.toString(); + assertThat(identityString, Matchers.matches("\\bId\\b")); + assertThat(identityString, Matchers.matches("\\bNickname\\b")); + } + } -- 2.7.4