From ba696c9462be0d282dce5dfde38ecf99a59ed864 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 26 Oct 2013 02:04:18 +0200 Subject: [PATCH] Also require a time when creating a post. --- .../java/net/pterodactylus/sone/fcp/AbstractSoneCommandTest.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/test/java/net/pterodactylus/sone/fcp/AbstractSoneCommandTest.java b/src/test/java/net/pterodactylus/sone/fcp/AbstractSoneCommandTest.java index d045be2..54c1908 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, "Some Text."); + Post post = createPost(sone, (long) (Math.random() * Long.MAX_VALUE), "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,11 +333,12 @@ public class AbstractSoneCommandTest { assertThat(parsedPost, is(post)); } - private Post createPost(Sone sone, String text) { + private Post createPost(Sone sone, long time, 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.getTime()).thenReturn(time); when(post.getText()).thenReturn(text); return post; } @@ -345,7 +346,7 @@ public class AbstractSoneCommandTest { @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, "Some Text."); + Post post = createPost(sone, (long) (Math.random() * Long.MAX_VALUE), "Some Text."); when(database.getPost(Matchers.any())).thenReturn(Optional.absent()); SimpleFieldSet postFieldSet = new SimpleFieldSetBuilder().put("Post", post.getId()).get(); abstractSoneCommand.getPost(postFieldSet, "Post"); -- 2.7.4