Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4f8a9b42 authored by Stefan Niedermann's avatar Stefan Niedermann
Browse files

Close test db explicitly and use older java syntax for initialization

parent a0476d54
Loading
Loading
Loading
Loading
+9 −3
Original line number Original line Diff line number Diff line
@@ -10,6 +10,7 @@ import androidx.test.core.app.ApplicationProvider;


import com.nextcloud.android.sso.exceptions.NextcloudHttpRequestFailedException;
import com.nextcloud.android.sso.exceptions.NextcloudHttpRequestFailedException;


import org.junit.After;
import org.junit.Before;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.Test;
@@ -17,8 +18,8 @@ import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import org.robolectric.annotation.Config;


import java.util.Arrays;
import java.util.Calendar;
import java.util.Calendar;
import java.util.List;
import java.util.Map;
import java.util.Map;


import it.niedermann.owncloud.notes.persistence.entity.Account;
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));
        db.addAccount("https://example.org", "test", "test@example.org", new Capabilities("{ocs: {}}", null));
        secondAccount = db.getAccountDao().getAccountByName("test@example.org");
        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(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(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),
                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(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(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)
                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
    @Test