Test setting a/no avatar.
[Sone.git] / src / test / java / net / pterodactylus / sone / data / ProfileTest.java
index 33d7fff..a4e70c0 100644 (file)
@@ -17,6 +17,7 @@
 
 package net.pterodactylus.sone.data;
 
+import static com.google.common.base.Optional.of;
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.contains;
 import static org.hamcrest.Matchers.is;
@@ -119,6 +120,13 @@ public class ProfileTest {
        }
 
        @Test
+       public void testDeletingANonExistingField() {
+               Field testField = profile.addField("TestField");
+               profile.removeField(testField);
+               profile.removeField(testField);
+       }
+
+       @Test
        public void testGettingFieldList() {
                Field firstField = profile.addField("First");
                Field secondField = profile.addField("Second");
@@ -173,4 +181,16 @@ public class ProfileTest {
                assertThat(profile.getBirthDay(), is(24));
        }
 
+       @Test
+       public void testSettingAnAvatar() {
+               profile.setAvatar(of("avatar1"));
+               assertThat(profile.getAvatar(), is("avatar1"));
+       }
+
+       @Test
+       public void testSettingNoAvatar() {
+               profile.setAvatar(Optional.<String>absent());
+               assertThat(profile.getAvatar(), is((String) null));
+       }
+
 }