knownPosts.add(post.id)
else
knownPosts.remove(post.id)
+ saveKnownPosts()
}
protected fun isPostReplyKnown(postReply: PostReply) = readLock.withLock { postReply.id in knownPostReplies }
try {
readLock.withLock {
knownPosts.forEachIndexed { index, knownPostId ->
- configuration.getStringValue("KnowsPosts/$index/ID").value = knownPostId
+ configuration.getStringValue("KnownPosts/$index/ID").value = knownPostId
}
configuration.getStringValue("KnownPosts/${knownPosts.size}/ID").value = null
}
assertThat(configuration.getLongValue("SoneFollowingTimes/0/Time").getValue(), equalTo(1000L));
}
+ @Test
+ public void markingAPostAsKnownSavesConfiguration() throws ConfigurationException {
+ prepareConfigurationValues();
+ Post post = mock(Post.class);
+ when(post.getId()).thenReturn("post-id");
+ memoryDatabase.setPostKnown(post, true);
+ assertThat(configuration.getStringValue("KnownPosts/0/ID").getValue(), equalTo("post-id"));
+ assertThat(configuration.getStringValue("KnownPosts/1/ID").getValue(), equalTo(null));
+ }
+
}