Add tests for starting and stopping the bookmark database.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 4 Nov 2014 19:05:07 +0000 (20:05 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 4 Nov 2014 19:05:07 +0000 (20:05 +0100)
src/test/java/net/pterodactylus/sone/database/memory/MemoryBookmarkDatabaseTest.java

index 8a97593..28cd200 100644 (file)
@@ -4,8 +4,10 @@ import static com.google.common.base.Optional.fromNullable;
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.contains;
 import static org.hamcrest.Matchers.is;
+import static org.mockito.Matchers.any;
 import static org.mockito.Matchers.anyString;
 import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
 import java.util.HashMap;
@@ -87,4 +89,16 @@ public class MemoryBookmarkDatabaseTest {
                }
        }
 
+       @Test
+       public void startingTheDatabaseLoadsBookmarkedPosts() {
+               bookmarkDatabase.start();
+               verify(configurationLoader).loadBookmarkedPosts();
+       }
+
+       @Test
+       public void stoppingTheDatabaseSavesTheBookmarkedPosts() {
+               bookmarkDatabase.stop();
+               verify(configurationLoader).saveBookmarkedPosts(any(Set.class));
+       }
+
 }