1 package net.pterodactylus.sone.test;
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 public class TestPostReplyBuilder implements PostReplyBuilder {
17 private final PostReply postReply = mock(PostReply.class);
20 public PostReplyBuilder to(String postId) {
21 when(postReply.getPostId()).thenReturn(postId);
26 public PostReply build() throws IllegalStateException {
31 public PostReplyBuilder randomId() {
32 when(postReply.getId()).thenReturn(randomUUID().toString());
37 public PostReplyBuilder withId(String id) {
38 when(postReply.getId()).thenReturn(id);
43 public PostReplyBuilder from(String senderId) {
44 Sone sone = mock(Sone.class);
45 when(sone.getId()).thenReturn(senderId);
46 when(postReply.getSone()).thenReturn(sone);
51 public PostReplyBuilder currentTime() {
52 when(postReply.getTime()).thenReturn(currentTimeMillis());
57 public PostReplyBuilder withTime(long time) {
58 when(postReply.getTime()).thenReturn(time);
63 public PostReplyBuilder withText(String text) {
64 when(postReply.getText()).thenReturn(text);