Code style cleanup
This commit is contained in:
parent
c76d85adde
commit
1da164bed4
2 changed files with 14 additions and 18 deletions
|
@ -294,10 +294,8 @@ public class Contacts {
|
|||
null,
|
||||
SORT_ORDER);
|
||||
} else {
|
||||
// return blank cursor
|
||||
return new EmptyCursor();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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 <address@example.org>")[0];
|
||||
static final Address CONTACT_ADDRESS_2 = Address.parse("Other Contact Name <address_two@example.org>")[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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue