Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/stefan-niedermann/nextcloud-notes.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Niedermann <info@niedermann.it>2021-04-08 21:27:11 +0300
committerStefan Niedermann <info@niedermann.it>2021-04-08 21:27:11 +0300
commit4f8a9b4297e045ce0475f698dddcdd4e556e8341 (patch)
tree326d9782f20a495d93df7c152c980635a32a8961
parenta0476d5402949316cd66b63d11ad49f5774554b4 (diff)
Close test db explicitly and use older java syntax for initialization
-rw-r--r--app/src/test/java/it/niedermann/owncloud/notes/persistence/NotesDatabaseTest.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/app/src/test/java/it/niedermann/owncloud/notes/persistence/NotesDatabaseTest.java b/app/src/test/java/it/niedermann/owncloud/notes/persistence/NotesDatabaseTest.java
index 1178646c..7b5c94c9 100644
--- a/app/src/test/java/it/niedermann/owncloud/notes/persistence/NotesDatabaseTest.java
+++ b/app/src/test/java/it/niedermann/owncloud/notes/persistence/NotesDatabaseTest.java
@@ -10,6 +10,7 @@ import androidx.test.core.app.ApplicationProvider;
import com.nextcloud.android.sso.exceptions.NextcloudHttpRequestFailedException;
+import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -17,8 +18,8 @@ import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
+import java.util.Arrays;
import java.util.Calendar;
-import java.util.List;
import java.util.Map;
import it.niedermann.owncloud.notes.persistence.entity.Account;
@@ -57,7 +58,7 @@ public class NotesDatabaseTest {
db.addAccount("https://example.org", "test", "test@example.org", new Capabilities("{ocs: {}}", null));
secondAccount = db.getAccountDao().getAccountByName("test@example.org");
- List.of(
+ Arrays.stream(new Note[]{
new Note(1, 1001L, Calendar.getInstance(), "美好的一天", "C", "Movies", false, null, VOID, account.getId(), "", 0),
new Note(2, null, Calendar.getInstance(), "T", "C", "Movies", false, null, LOCAL_EDITED, account.getId(), "", 0),
new Note(3, 1003L, Calendar.getInstance(), "美好的一天", "C", "Movies", false, null, LOCAL_EDITED, account.getId(), "", 0),
@@ -67,7 +68,12 @@ public class NotesDatabaseTest {
new Note(7, null, Calendar.getInstance(), "T", "C", "Music", true, null, LOCAL_EDITED, secondAccount.getId(), "", 0),
new Note(8, 1008L, Calendar.getInstance(), "美好的一天", "C", "ToDo", true, null, LOCAL_EDITED, secondAccount.getId(), "", 0),
new Note(9, 1009L, Calendar.getInstance(), "美好的一天", "C", "ToDo", true, null, LOCAL_DELETED, secondAccount.getId(), "", 0)
- ).forEach(note -> db.getNoteDao().addNote(note));
+ }).forEach(note -> db.getNoteDao().addNote(note));
+ }
+
+ @After
+ public void closeDb() {
+ db.close();
}
@Test