Add test for CreatePostPage
[Sone.git] / src / test / java / net / pterodactylus / sone / web / WebPageTest.java
index f464eac..2717174 100644 (file)
@@ -70,6 +70,8 @@ public abstract class WebPageTest {
        public final void setupCore() {
                UpdateChecker updateChecker = mock(UpdateChecker.class);
                when(core.getUpdateChecker()).thenReturn(updateChecker);
+               when(core.getLocalSone(anyString())).thenReturn(null);
+               when(core.getSone(anyString())).thenReturn(Optional.<Sone>absent());
        }
 
        @Before
@@ -102,4 +104,12 @@ public abstract class WebPageTest {
                when(core.getPost(postId)).thenReturn(Optional.fromNullable(post));
        }
 
+       protected void addSone(String soneId, Sone sone) {
+               when(core.getSone(eq(soneId))).thenReturn(Optional.fromNullable(sone));
+       }
+
+       protected void addLocalSone(String soneId, Sone sone) {
+               when(core.getLocalSone(eq(soneId))).thenReturn(sone);
+       }
+
 }