return sone;
}
- public static Post mockPost(Core core, String postId) {
+ public static Post mockPost(Core core, Sone sone, String postId) {
Post post = mock(Post.class);
when(post.getId()).thenReturn(postId);
+ when(post.getSone()).thenReturn(sone);
Database database = core.getDatabase();
when(database.getPost(eq(postId))).thenReturn(of(post));
return post;
@Test
public void verifyThatCreatingAFullySpecifiedReplyWorks() throws FcpException {
Sone sone = mockLocalSone(core, "SoneId");
- mockPost(core, "PostId");
+ mockPost(core, sone, "PostId");
CapturingPostReplyCreated capturingPostReplyCreated = new CapturingPostReplyCreated();
when(core.postReplyCreated()).thenReturn(Optional.<PostReplyCreated>of(capturingPostReplyCreated));
SimpleFieldSet createReplyFieldSet = new SimpleFieldSetBuilder()
@Test(expected = FcpException.class)
public void verifyThatCreatingAReplyWithoutSoneCausesAnError() throws FcpException {
- mockPost(core, "PostId");
+ Sone sone = mockLocalSone(core, "SoneId");
+ mockPost(core, sone, "PostId");
CapturingPostReplyCreated capturingPostReplyCreated = new CapturingPostReplyCreated();
when(core.postReplyCreated()).thenReturn(Optional.<PostReplyCreated>of(capturingPostReplyCreated));
SimpleFieldSet createReplyFieldSet = new SimpleFieldSetBuilder()
@Test(expected = FcpException.class)
public void verifyThatCreatingAReplyWithoutTextCausesAnError() throws FcpException {
- mockLocalSone(core, "SoneId");
- mockPost(core, "PostId");
+ Sone sone = mockLocalSone(core, "SoneId");
+ mockPost(core, sone, "PostId");
CapturingPostReplyCreated capturingPostReplyCreated = new CapturingPostReplyCreated();
when(core.postReplyCreated()).thenReturn(Optional.<PostReplyCreated>of(capturingPostReplyCreated));
SimpleFieldSet createReplyFieldSet = new SimpleFieldSetBuilder()