Loading k9mail/src/main/java/com/fsck/k9/mailstore/LocalStore.java +4 −0 Original line number Diff line number Diff line Loading @@ -258,6 +258,10 @@ public class LocalStore extends Store implements Serializable { database.switchProvider(newStorageProviderId); } Context getContext() { return context; } protected Account getAccount() { return mAccount; } Loading k9mail/src/main/java/com/fsck/k9/mailstore/StoreSchemaDefinition.java +1 −1 Original line number Diff line number Diff line Loading @@ -238,7 +238,7 @@ class StoreSchemaDefinition implements LockableDatabase.SchemaDefinition { @Override public Context getContext() { return localStore.context; return localStore.getContext(); } @Override Loading k9mail/src/test/java/com/fsck/k9/mailstore/StoreSchemaDefinitionTest.java +10 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ import java.util.List; import android.app.Application; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; Loading @@ -14,6 +15,7 @@ import com.fsck.k9.Account; import com.fsck.k9.BuildConfig; import com.fsck.k9.GlobalsHelper; import com.fsck.k9.K9; import com.fsck.k9.R; import com.fsck.k9.mail.MessagingException; import org.junit.Before; import org.junit.Test; Loading Loading @@ -316,16 +318,24 @@ public class StoreSchemaDefinitionTest { } private StoreSchemaDefinition createStoreSchemaDefinition() throws MessagingException { Context context = createContext(); Account account = createAccount(); LockableDatabase lockableDatabase = createLockableDatabase(); LocalStore localStore = mock(LocalStore.class); localStore.database = lockableDatabase; when(localStore.getContext()).thenReturn(context); when(localStore.getAccount()).thenReturn(account); return new StoreSchemaDefinition(localStore); } private Context createContext() { Context context = mock(Context.class); when(context.getString(R.string.special_mailbox_name_outbox)).thenReturn("Outbox"); return context; } private LockableDatabase createLockableDatabase() throws MessagingException { LockableDatabase lockableDatabase = mock(LockableDatabase.class); when(lockableDatabase.execute(anyBoolean(), any(LockableDatabase.DbCallback.class))).thenReturn(false); Loading Loading
k9mail/src/main/java/com/fsck/k9/mailstore/LocalStore.java +4 −0 Original line number Diff line number Diff line Loading @@ -258,6 +258,10 @@ public class LocalStore extends Store implements Serializable { database.switchProvider(newStorageProviderId); } Context getContext() { return context; } protected Account getAccount() { return mAccount; } Loading
k9mail/src/main/java/com/fsck/k9/mailstore/StoreSchemaDefinition.java +1 −1 Original line number Diff line number Diff line Loading @@ -238,7 +238,7 @@ class StoreSchemaDefinition implements LockableDatabase.SchemaDefinition { @Override public Context getContext() { return localStore.context; return localStore.getContext(); } @Override Loading
k9mail/src/test/java/com/fsck/k9/mailstore/StoreSchemaDefinitionTest.java +10 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ import java.util.List; import android.app.Application; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; Loading @@ -14,6 +15,7 @@ import com.fsck.k9.Account; import com.fsck.k9.BuildConfig; import com.fsck.k9.GlobalsHelper; import com.fsck.k9.K9; import com.fsck.k9.R; import com.fsck.k9.mail.MessagingException; import org.junit.Before; import org.junit.Test; Loading Loading @@ -316,16 +318,24 @@ public class StoreSchemaDefinitionTest { } private StoreSchemaDefinition createStoreSchemaDefinition() throws MessagingException { Context context = createContext(); Account account = createAccount(); LockableDatabase lockableDatabase = createLockableDatabase(); LocalStore localStore = mock(LocalStore.class); localStore.database = lockableDatabase; when(localStore.getContext()).thenReturn(context); when(localStore.getAccount()).thenReturn(account); return new StoreSchemaDefinition(localStore); } private Context createContext() { Context context = mock(Context.class); when(context.getString(R.string.special_mailbox_name_outbox)).thenReturn("Outbox"); return context; } private LockableDatabase createLockableDatabase() throws MessagingException { LockableDatabase lockableDatabase = mock(LockableDatabase.class); when(lockableDatabase.execute(anyBoolean(), any(LockableDatabase.DbCallback.class))).thenReturn(false); Loading