+ /**
+ * {@inheritDocs}
+ */
+ @Override
+ public Collection<Sone> getSones() {
+ return null;
+ }
+
+ /**
+ * {@inheritDocs}
+ */
+ @Override
+ public Collection<Sone> getLocalSones() {
+ return null;
+ }
+
+ /**
+ * {@inheritDocs}
+ */
+ @Override
+ public Collection<Sone> getRemoteSones() {
+ return null;
+ }
+
+ }
+
+ private static class TestPostProvider implements PostProvider {
+
+ private final Map<String, String> postTexts = new HashMap<String, String>();
+ private final Map<String, String> postInternalIds = new HashMap<String, String>();
+ private final Map<String, String> internalIdPosts = new HashMap<String, String>();
+
+ private void addValidPostId(String validPostId, String internalId, String text) {
+ postTexts.put(validPostId, text);
+ postInternalIds.put(validPostId, internalId);
+ internalIdPosts.put(internalId, validPostId);
+ }
+
+ @Override
+ public Collection<Post> getDirectedPosts(String recipientId) {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public Collection<Post> getPosts(String soneId) {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public Optional<Post> getPost(String postId) {
+ if (postTexts.containsKey(postId)) {
+ Post post = mock(Post.class);
+ when(post.getId()).thenReturn(postId);
+ when(post.getInternalId()).thenReturn(postInternalIds.get(postId));
+ when(post.getText()).thenReturn(postTexts.get(postId));
+ return Optional.of(post);
+ } else if (internalIdPosts.containsKey(postId)) {
+ Post post = mock(Post.class);
+ when(post.getId()).thenReturn(internalIdPosts.get(postId));
+ when(post.getInternalId()).thenReturn(postId);
+ when(post.getText()).thenReturn(postTexts.get(internalIdPosts.get(postId)));
+ return Optional.of(post);
+ }
+ return Optional.absent();
+ }
+
+ }
+
+ private static class TestAlbumProvider implements AlbumProvider {
+
+ private final Map<String, String> albumTitles = new HashMap<String, String>();
+
+ public void addAlbumTitle(String albumId, String albumTitle) {
+ albumTitles.put(albumId, albumTitle);
+ }
+
+ @Override
+ public Optional<Album> getAlbum(String albumId) {
+ if (albumTitles.containsKey(albumId)) {
+ Album album = mock(Album.class);
+ when(album.getId()).thenReturn(albumId);
+ when(album.getTitle()).thenReturn(albumTitles.get(albumId));
+ return Optional.of(album);
+ }
+ return Optional.absent();