From: David ‘Bombe’ Roden Date: Wed, 13 Nov 2013 05:47:53 +0000 (+0100) Subject: Increase coverage of default identity. X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=commitdiff_plain;h=f04bfc068ba3d2100d68e80754903f7d43274527 Increase coverage of default identity. --- 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")); + } + }