X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Ftest%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fdatabase%2Fmemory%2FMemoryBookmarkDatabaseTest.java;h=188b74019ea484a707695b40672084f6dd81f5a4;hb=1acab7994675db5fc17a7d242d7de0304efb6987;hp=c16ce9dfa27f6a0e1b992b83c0e7f030b9ec131d;hpb=7b55e0be6a3283e43a9bbab98f82aebdd948eb33;p=Sone.git
diff --git a/src/test/java/net/pterodactylus/sone/database/memory/MemoryBookmarkDatabaseTest.java b/src/test/java/net/pterodactylus/sone/database/memory/MemoryBookmarkDatabaseTest.java
index c16ce9d..188b740 100644
--- a/src/test/java/net/pterodactylus/sone/database/memory/MemoryBookmarkDatabaseTest.java
+++ b/src/test/java/net/pterodactylus/sone/database/memory/MemoryBookmarkDatabaseTest.java
@@ -1,7 +1,6 @@
package net.pterodactylus.sone.database.memory;
-import static com.google.common.base.Optional.fromNullable;
-import static net.pterodactylus.sone.Matchers.isPostWithId;
+import static net.pterodactylus.sone.test.Matchers.isPostWithId;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.is;
@@ -19,7 +18,6 @@ import java.util.Set;
import net.pterodactylus.sone.data.Post;
-import com.google.common.base.Optional;
import org.junit.Before;
import org.junit.Test;
import org.mockito.invocation.InvocationOnMock;
@@ -27,8 +25,6 @@ import org.mockito.stubbing.Answer;
/**
* Unit test for {@link MemoryBookmarkDatabase}.
- *
- * @author David âBombeâ Roden
*/
public class MemoryBookmarkDatabaseTest {
@@ -37,17 +33,16 @@ public class MemoryBookmarkDatabaseTest {
mock(ConfigurationLoader.class);
private final MemoryBookmarkDatabase bookmarkDatabase =
new MemoryBookmarkDatabase(memoryDatabase, configurationLoader);
- private final Map posts = new HashMap();
+ private final Map posts = new HashMap<>();
@Before
public void setupMemoryDatabase() {
when(memoryDatabase.getPost(anyString())).thenAnswer(
- new Answer>() {
+ new Answer() {
@Override
- public Optional answer(
+ public Post answer(
InvocationOnMock invocation) {
- return fromNullable(
- posts.get(invocation.getArguments()[0]));
+ return posts.get(invocation.getArguments()[0]);
}
});
}
@@ -72,7 +67,7 @@ public class MemoryBookmarkDatabaseTest {
@Test
public void bookmarkDatabaseRetainsBookmarkedPosts() {
- Set allPosts = new HashSet(posts.values());
+ Set allPosts = new HashSet<>(posts.values());
for (Post post : allPosts) {
bookmarkDatabase.bookmarkPost(post);
}
@@ -103,7 +98,7 @@ public class MemoryBookmarkDatabaseTest {
@Test
public void removingABookmarkRemovesTheCorrectBookmark() {
- Set allPosts = new HashSet(posts.values());
+ Set allPosts = new HashSet<>(posts.values());
for (Post post : allPosts) {
bookmarkDatabase.bookmarkPost(post);
}