From: David ‘Bombe’ Roden Date: Sat, 26 Oct 2013 00:01:45 +0000 (+0200) Subject: Also require the text when creating a post. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=17a1fc74298d28fca1de3a973f1f52c2faeb2708;p=Sone.git Also require the text when creating a post. --- diff --git a/src/test/java/net/pterodactylus/sone/fcp/AbstractSoneCommandTest.java b/src/test/java/net/pterodactylus/sone/fcp/AbstractSoneCommandTest.java index 86a7e3f..d045be2 100644 --- a/src/test/java/net/pterodactylus/sone/fcp/AbstractSoneCommandTest.java +++ b/src/test/java/net/pterodactylus/sone/fcp/AbstractSoneCommandTest.java @@ -325,7 +325,7 @@ public class AbstractSoneCommandTest { @Test public void testParsingAPost() throws FcpException { Sone sone = createSone("jXH8d-eFdm14R69WyaCgQoSjaY0jl-Ut6etlXjK0e6E", "Test", "First", "M.", "Last", (long) (Math.random() * Long.MAX_VALUE)); - Post post = createPost(sone); + Post post = createPost(sone, "Some Text."); when(database.getPost(eq(post.getId()))).thenReturn(of(post)); SimpleFieldSet postFieldSet = new SimpleFieldSetBuilder().put("Post", post.getId()).get(); Post parsedPost = abstractSoneCommand.getPost(postFieldSet, "Post"); @@ -333,17 +333,19 @@ public class AbstractSoneCommandTest { assertThat(parsedPost, is(post)); } - private Post createPost(Sone sone) { + private Post createPost(Sone sone, String text) { Post post = mock(Post.class); when(post.getId()).thenReturn(randomUUID().toString()); when(post.getSone()).thenReturn(sone); + when(post.getRecipientId()).thenReturn(Optional.absent()); + when(post.getText()).thenReturn(text); return post; } @Test(expected = FcpException.class) public void testThatTryingToParseANonExistingPostCausesAnError() throws FcpException { Sone sone = createSone("jXH8d-eFdm14R69WyaCgQoSjaY0jl-Ut6etlXjK0e6E", "Test", "First", "M.", "Last", (long) (Math.random() * Long.MAX_VALUE)); - Post post = createPost(sone); + Post post = createPost(sone, "Some Text."); when(database.getPost(Matchers.any())).thenReturn(Optional.absent()); SimpleFieldSet postFieldSet = new SimpleFieldSetBuilder().put("Post", post.getId()).get(); abstractSoneCommand.getPost(postFieldSet, "Post");