Increase coverage of default identity.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 13 Nov 2013 05:47:53 +0000 (06:47 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 28 Feb 2014 21:26:00 +0000 (22:26 +0100)
src/test/java/net/pterodactylus/sone/freenet/wot/DefaultIdentityTest.java

index 13ded53..1cd462c 100644 (file)
@@ -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"));
+       }
+
 }