1 package net.pterodactylus.sone;
3 import static java.lang.System.currentTimeMillis;
4 import static java.util.UUID.randomUUID;
5 import static org.mockito.Mockito.mock;
6 import static org.mockito.Mockito.when;
8 import net.pterodactylus.sone.data.PostReply;
9 import net.pterodactylus.sone.data.Sone;
10 import net.pterodactylus.sone.database.PostReplyBuilder;
13 * {@link PostReplyBuilder} that returns a mocked {@link PostReply}.
15 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
17 public class TestPostReplyBuilder implements PostReplyBuilder {
19 private final PostReply postReply = mock(PostReply.class);
22 public PostReplyBuilder to(String postId) {
23 when(postReply.getPostId()).thenReturn(postId);
28 public PostReply build() throws IllegalStateException {
33 public PostReplyBuilder randomId() {
34 when(postReply.getId()).thenReturn(randomUUID().toString());
39 public PostReplyBuilder withId(String id) {
40 when(postReply.getId()).thenReturn(id);
45 public PostReplyBuilder from(String senderId) {
46 Sone sone = mock(Sone.class);
47 when(sone.getId()).thenReturn(senderId);
48 when(postReply.getSone()).thenReturn(sone);
53 public PostReplyBuilder currentTime() {
54 when(postReply.getTime()).thenReturn(currentTimeMillis());
59 public PostReplyBuilder withTime(long time) {
60 when(postReply.getTime()).thenReturn(time);
65 public PostReplyBuilder withText(String text) {
66 when(postReply.getText()).thenReturn(text);