@@ -0,0 +1,1946 @@
+package io.github.plastix.forage.data.local;%0A%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.powermock.api.mockito.PowerMockito;%0Aimport org.powermock.core.classloader.annotations.PrepareForTest;%0Aimport org.powermock.modules.junit4.PowerMockRunner;%0A%0Aimport dagger.Lazy;%0Aimport io.realm.Realm;%0A%0Aimport static org.mockito.Mockito.verify;%0Aimport static org.mockito.Mockito.verifyNoMoreInteractions;%0A%0A/**%0A * Todo instrumentation tests for Realm%0A * Realm relies heavily on native code on Android. Since we can't actually run a realm during the%0A * unit tests we can only verify a few interactions with the mock. Testing the functionality of other%0A * DatabaseInteractor methods must be done with instrumentation tests.%0A */%0A@RunWith(PowerMockRunner.class)%0A@PrepareForTest(Realm.class)%0Apublic class DatabaseInteractorTest %7B%0A%0A    private DatabaseInteractor databaseInteractor;%0A    private Realm realm;%0A    private Lazy%3CRealm%3E realmLazy;%0A%0A    @Before%0A    public void beforeEachTest() %7B%0A        realm = PowerMockito.mock(Realm.class);%0A        realmLazy = new Lazy%3CRealm%3E() %7B%0A            @Override%0A            public Realm get() %7B%0A                return realm;%0A            %7D%0A        %7D;%0A        databaseInteractor = new DatabaseInteractor(realmLazy);%0A    %7D%0A%0A    @Test%0A    public void onDestroy_shouldCallRealmClose() %7B%0A        databaseInteractor.onDestroy();%0A        verify(realm).close();%0A    %7D%0A%0A    @Test%0A    public void onPause_noOp() %7B%0A        databaseInteractor.onPause();%0A        verifyNoMoreInteractions(realm);%0A%0A    %7D%0A%0A    @Test%0A    public void onStart_noOp() %7B%0A        databaseInteractor.onStart();%0A        verifyNoMoreInteractions(realm);%0A    %7D%0A%0A    @Test%0A    public void onStop_noOp() %7B%0A        databaseInteractor.onStop();%0A        verifyNoMoreInteractions(realm);%0A    %7D%0A%0A    @Test%0A    public void onResume_noOp() %7B%0A        databaseInteractor.onResume();%0A        verifyNoMoreInteractions(realm);%0A%0A    %7D%0A%7D%0A

Add a few DatabaseInteractor unit tests. Testing Realm is tricky since it uses native code on Android. Other DatabaseInteractor tests will need to be done as instrumentation tests.