List of usage examples for android.test MoreAsserts assertNotEqual
public static void assertNotEqual(Object unexpected, Object actual)
From source file:com.ichi2.libanki.test.ModelsTestCase.java
@MediumTest public void test_modelCopy() throws JSONException { Collection deck = Shared.getEmptyDeck(getInstrumentation().getContext()); JSONObject m = deck.getModels().current(); JSONObject m2 = deck.getModels().copy(m); assertEquals(m2.getString("name"), "Basic copy"); MoreAsserts.assertNotEqual(m2.getInt("id"), m.getInt("id")); assertEquals(m2.getJSONArray("flds").length(), 2); assertEquals(m.getJSONArray("flds").length(), 2); assertEquals(m2.getJSONArray("flds").length(), m.getJSONArray("flds").length()); assertEquals(m.getJSONArray("tmpls").length(), 1); assertEquals(m2.getJSONArray("tmpls").length(), 1); assertEquals(deck.getModels().scmhash(m), deck.getModels().scmhash(m2)); }
From source file:com.android.email.mail.store.ImapStoreUnitTests.java
/** * Test that IMAP ID uid's are per-username *//* w w w.ja va 2 s . co m*/ public void testImapIdDeviceId() throws MessagingException { ImapStore store1a = (ImapStore) ImapStore.newInstance("imap://user1:password@server:999", getContext(), null); ImapStore store1b = (ImapStore) ImapStore.newInstance("imap://user1:password@server:999", getContext(), null); ImapStore store2 = (ImapStore) ImapStore.newInstance("imap://user2:password@server:999", getContext(), null); String id1a = ImapStore.getImapId(getContext(), "user1", "host-name", CAPABILITY_RESPONSE); String id1b = ImapStore.getImapId(getContext(), "user1", "host-name", CAPABILITY_RESPONSE); String id2 = ImapStore.getImapId(getContext(), "user2", "host-name", CAPABILITY_RESPONSE); String uid1a = tokenizeImapId(id1a).get("AGUID"); String uid1b = tokenizeImapId(id1b).get("AGUID"); String uid2 = tokenizeImapId(id2).get("AGUID"); assertEquals(uid1a, uid1b); MoreAsserts.assertNotEqual(uid1a, uid2); }
From source file:com.appaholics.email.mail.store.ImapStoreUnitTests.java
/** * Test that IMAP ID uid's are per-username *//*from ww w .j av a2s.c o m*/ public void testImapIdDeviceId() throws MessagingException { HostAuth testAuth; Account testAccount; // store 1a testAuth = new HostAuth(); testAuth.setLogin("user1", "password"); testAuth.setConnection("imap", "server", 999); testAccount = new Account(); testAccount.mHostAuthRecv = testAuth; ImapStore testStore1A = (ImapStore) ImapStore.newInstance(testAccount, mTestContext); // store 1b testAuth = new HostAuth(); testAuth.setLogin("user1", "password"); testAuth.setConnection("imap", "server", 999); testAccount = new Account(); testAccount.mHostAuthRecv = testAuth; ImapStore testStore1B = (ImapStore) ImapStore.newInstance(testAccount, mTestContext); // store 2 testAuth = new HostAuth(); testAuth.setLogin("user2", "password"); testAuth.setConnection("imap", "server", 999); testAccount = new Account(); testAccount.mHostAuthRecv = testAuth; ImapStore testStore2 = (ImapStore) ImapStore.newInstance(testAccount, mTestContext); String capabilities = CAPABILITY_RESPONSE.flatten(); String id1a = ImapStore.getImapId(mTestContext, "user1", "host-name", capabilities); String id1b = ImapStore.getImapId(mTestContext, "user1", "host-name", capabilities); String id2 = ImapStore.getImapId(mTestContext, "user2", "host-name", capabilities); String uid1a = tokenizeImapId(id1a).get("AGUID"); String uid1b = tokenizeImapId(id1b).get("AGUID"); String uid2 = tokenizeImapId(id2).get("AGUID"); assertEquals(uid1a, uid1b); MoreAsserts.assertNotEqual(uid1a, uid2); }