eventBus.post(new NewPostReplyFoundEvent(reply));
sone.addReply(reply);
touchConfiguration();
- localElementTicker.schedule(new Runnable() {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void run() {
- markReplyKnown(reply);
- }
- }, 10, TimeUnit.SECONDS);
+ localElementTicker.schedule(new MarkReplyKnown(reply), 10, TimeUnit.SECONDS);
return reply;
}
}
+ @VisibleForTesting
+ class MarkReplyKnown implements Runnable {
+
+ private final PostReply postReply;
+
+ public MarkReplyKnown(PostReply postReply) {
+ this.postReply = postReply;
+ }
+
+ @Override
+ public void run() {
+ markReplyKnown(postReply);
+ }
+
+ }
+
}
import static org.mockito.Mockito.verify;
import net.pterodactylus.sone.core.Core.MarkPostKnown;
+import net.pterodactylus.sone.core.Core.MarkReplyKnown;
import net.pterodactylus.sone.data.Post;
+import net.pterodactylus.sone.data.PostReply;
import org.junit.Test;
verify(core).markPostKnown(eq(post));
}
+ @Test
+ public void markReplyKnownMarksReplyAsKnown() {
+ Core core = mock(Core.class);
+ PostReply postReply = mock(PostReply.class);
+ MarkReplyKnown markReplyKnown = core.new MarkReplyKnown(postReply);
+ markReplyKnown.run();
+ verify(core).markReplyKnown(eq(postReply));
+ }
+
}