From 1da164bed4efdb0de0ce650de5025e3a5bfbf8ea Mon Sep 17 00:00:00 2001 From: cketti Date: Wed, 28 Nov 2018 05:15:35 +0100 Subject: [PATCH] Code style cleanup --- .../java/com/fsck/k9/helper/Contacts.java | 2 -- .../activity/compose/RecipientLoaderTest.java | 30 +++++++++---------- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/app/core/src/main/java/com/fsck/k9/helper/Contacts.java b/app/core/src/main/java/com/fsck/k9/helper/Contacts.java index 3669f92ba..56e4e08b0 100644 --- a/app/core/src/main/java/com/fsck/k9/helper/Contacts.java +++ b/app/core/src/main/java/com/fsck/k9/helper/Contacts.java @@ -294,10 +294,8 @@ public class Contacts { null, SORT_ORDER); } else { - // return blank cursor return new EmptyCursor(); } - } /** diff --git a/app/ui/src/test/java/com/fsck/k9/activity/compose/RecipientLoaderTest.java b/app/ui/src/test/java/com/fsck/k9/activity/compose/RecipientLoaderTest.java index 3b64e47e6..d7f0c12b8 100644 --- a/app/ui/src/test/java/com/fsck/k9/activity/compose/RecipientLoaderTest.java +++ b/app/ui/src/test/java/com/fsck/k9/activity/compose/RecipientLoaderTest.java @@ -15,10 +15,8 @@ import com.fsck.k9.RobolectricTest; import com.fsck.k9.mail.Address; import com.fsck.k9.view.RecipientSelectView.Recipient; import com.fsck.k9.view.RecipientSelectView.RecipientCryptoStatus; - import org.junit.Before; import org.junit.Test; -import org.robolectric.RuntimeEnvironment; import org.robolectric.shadows.ShadowApplication; import static android.provider.ContactsContract.CommonDataKinds.Email.TYPE_HOME; @@ -50,21 +48,21 @@ public class RecipientLoaderTest extends RobolectricTest { ContactsContract.Data.CONTACT_ID, ContactsContract.CommonDataKinds.Nickname.NAME }; - static final String[] PROJECTION_CRYPTO_ADDRESSES = {"address", "uid_address"}; - static final String[] PROJECTION_CRYPTO_STATUS = {"address", "uid_key_status", "autocrypt_key_status"}; + static final String[] PROJECTION_CRYPTO_ADDRESSES = { "address", "uid_address" }; + static final String[] PROJECTION_CRYPTO_STATUS = { "address", "uid_key_status", "autocrypt_key_status" }; static final Address CONTACT_ADDRESS_1 = Address.parse("Contact Name ")[0]; static final Address CONTACT_ADDRESS_2 = Address.parse("Other Contact Name ")[0]; static final String TYPE = "" + TYPE_HOME; static final String[] CONTACT_1 = - new String[]{"0", "Bob", "bob", "bob@host.com", TYPE, null, "1", null, "100", "Bob"}; + new String[] { "0", "Bob", "bob", "bob@host.com", TYPE, null, "1", null, "100", "Bob" }; static final String[] CONTACT_2 = - new String[]{"2", "Bob2", "bob2", "bob2@host.com", TYPE, null, "2", null, "99", "Bob2"}; + new String[] { "2", "Bob2", "bob2", "bob2@host.com", TYPE, null, "2", null, "99", "Bob2" }; static final String[] CONTACT_NO_EMAIL = - new String[]{"0", "Bob", "bob", null, TYPE, null, "1", null, "10", "Bob_noMail"}; + new String[] { "0", "Bob", "bob", null, TYPE, null, "1", null, "10", "Bob_noMail" }; static final String[] CONTACT_WITH_NICKNAME_NOT_CONTACTED = - new String[]{"0", "Eve_notContacted", "eve_notContacted", "eve_notContacted@host.com", TYPE, null, "2", - null, "0", "Eve"}; - static final String[] NICKNAME_NOT_CONTACTED = new String[]{"2", "Eves_Nickname_Bob"}; + new String[] { "0", "Eve_notContacted", "eve_notContacted", "eve_notContacted@host.com", TYPE, null, "2", + null, "0", "Eve" }; + static final String[] NICKNAME_NOT_CONTACTED = new String[] { "2", "Eves_Nickname_Bob" }; static final String QUERYSTRING = "querystring"; @@ -159,24 +157,24 @@ public class RecipientLoaderTest extends RobolectricTest { private void setupQueryCryptoProvider(String queriedAddress, Address... contactAddresses) { MatrixCursor cursor = new MatrixCursor(PROJECTION_CRYPTO_ADDRESSES); for (Address contactAddress : contactAddresses) { - cursor.addRow(new String[]{queriedAddress, contactAddress.toString()}); + cursor.addRow(new String[] { queriedAddress, contactAddress.toString() }); } when(contentResolver .query(eq(Uri.parse("content://" + CRYPTO_PROVIDER + ".provider.exported/autocrypt_status")), aryEq(PROJECTION_CRYPTO_ADDRESSES), nullable(String.class), - aryEq(new String[]{queriedAddress}), + aryEq(new String[] { queriedAddress }), nullable(String.class))).thenReturn(cursor); } private void setupCryptoProviderStatus(Address address, String uidStatus, String autocryptStatus) { MatrixCursor cursorCryptoStatus = new MatrixCursor(PROJECTION_CRYPTO_STATUS); - cursorCryptoStatus.addRow(new String[]{address.getAddress(), uidStatus, autocryptStatus}); + cursorCryptoStatus.addRow(new String[] { address.getAddress(), uidStatus, autocryptStatus }); when(contentResolver .query(eq(Uri.parse("content://" + CRYPTO_PROVIDER + ".provider.exported/autocrypt_status")), aryEq(PROJECTION_CRYPTO_STATUS), nullable(String.class), - aryEq(new String[]{address.getAddress()}), + aryEq(new String[] { address.getAddress() }), nullable(String.class))).thenReturn(cursorCryptoStatus); } @@ -189,7 +187,7 @@ public class RecipientLoaderTest extends RobolectricTest { .query(eq(Email.CONTENT_URI), aryEq(PROJECTION), nullable(String.class), - aryEq(new String[]{queriedAddress, queriedAddress}), + aryEq(new String[] { queriedAddress, queriedAddress }), nullable(String.class))).thenReturn(cursor); } @@ -215,7 +213,7 @@ public class RecipientLoaderTest extends RobolectricTest { .query(eq(Email.CONTENT_URI), aryEq(PROJECTION), nullable(String.class), - aryEq(new String[]{id}), + aryEq(new String[] { id }), nullable(String.class))).thenReturn(cursor); }