}
public static Sone mockLocalSone(Core core, final String id) {
- Sone sone = mock(Sone.class);
- when(sone.getId()).thenReturn(id);
+ Sone sone = mockRemoteSone(core, id);
when(sone.isLocal()).thenReturn(true);
final Database database = core.getDatabase();
when(sone.newPostBuilder()).thenReturn(new DefaultPostBuilder(database, id));
return new DefaultPostReplyBuilder(database, id, postIdCaptor.getValue());
}
});
- when(core.getSone(eq(id))).thenReturn(of(sone));
- when(database.getSone(eq(id))).thenReturn(of(sone));
return sone;
}
when(sone.getId()).thenReturn(id);
when(sone.isLocal()).thenReturn(false);
final Database database = core.getDatabase();
- when(sone.newPostBuilder()).thenReturn(new DefaultPostBuilder(database, id));
+ when(sone.newPostBuilder()).thenThrow(IllegalStateException.class);
when(sone.newPostReplyBuilder(Matchers.<String>anyObject())).thenThrow(IllegalStateException.class);
when(core.getSone(eq(id))).thenReturn(of(sone));
when(database.getSone(eq(id))).thenReturn(of(sone));