1
0
mirror of https://github.com/owncloud/android-library.git synced 2026-08-11 16:33:03 +00:00

Updated unit tests

This commit is contained in:
David A. Velasco
2015-02-10 12:57:17 +01:00
parent f5fe254c09
commit 24110ba178
4 changed files with 55 additions and 24 deletions
@@ -94,23 +94,31 @@ public class SimpleFactoryManagerTest extends AndroidTestCase {
}
public void testGetClientFor() {
OwnCloudClient client = mSFMgr.getClientFor(mValidAccount, getContext());
try {
OwnCloudClient client = mSFMgr.getClientFor(mValidAccount, getContext());
assertNotSame("Got same client instances for same account",
client, mSFMgr.getClientFor(mValidAccount, getContext()));
assertNotSame("Got same client instances for same account",
client, mSFMgr.getClientFor(mValidAccount, getContext()));
assertNotSame("Got same client instances for different accounts",
client, mSFMgr.getClientFor(mAnonymousAccount, getContext()));
assertNotSame("Got same client instances for different accounts",
client, mSFMgr.getClientFor(mAnonymousAccount, getContext()));
} catch (Exception e) {
throw new AssertionFailedError("Exception getting client for account: " + e.getMessage());
}
// TODO harder tests
}
public void testRemoveClientFor() {
OwnCloudClient client = mSFMgr.getClientFor(mValidAccount, getContext());
mSFMgr.removeClientFor(mValidAccount);
assertNotSame("Got same client instance after removing it from manager",
client, mSFMgr.getClientFor(mValidAccount, getContext()));
try {
OwnCloudClient client = mSFMgr.getClientFor(mValidAccount, getContext());
mSFMgr.removeClientFor(mValidAccount);
assertNotSame("Got same client instance after removing it from manager",
client, mSFMgr.getClientFor(mValidAccount, getContext()));
} catch (Exception e) {
throw new AssertionFailedError("Exception getting client for account: " + e.getMessage());
}
// TODO harder tests
}
@@ -93,22 +93,31 @@ public class SingleSessionManagerTest extends AndroidTestCase {
}
public void testGetClientFor() {
OwnCloudClient client1 = mSSMgr.getClientFor(mValidAccount, getContext());
OwnCloudClient client2 = mSSMgr.getClientFor(mAnonymousAccount, getContext());
assertNotSame("Got same client instances for different accounts",
client1, client2);
assertSame("Got different client instances for same account",
client1, mSSMgr.getClientFor(mValidAccount, getContext()));
try {
OwnCloudClient client1 = mSSMgr.getClientFor(mValidAccount, getContext());
OwnCloudClient client2 = mSSMgr.getClientFor(mAnonymousAccount, getContext());
assertNotSame("Got same client instances for different accounts",
client1, client2);
assertSame("Got different client instances for same account",
client1, mSSMgr.getClientFor(mValidAccount, getContext()));
} catch (Exception e) {
throw new AssertionFailedError("Exception getting client for account: " + e.getMessage());
}
// TODO harder tests
}
public void testRemoveClientFor() {
OwnCloudClient client1 = mSSMgr.getClientFor(mValidAccount, getContext());
mSSMgr.removeClientFor(mValidAccount);
assertNotSame("Got same client instance after removing it from manager",
client1, mSSMgr.getClientFor(mValidAccount, getContext()));
try {
OwnCloudClient client1 = mSSMgr.getClientFor(mValidAccount, getContext());
mSSMgr.removeClientFor(mValidAccount);
assertNotSame("Got same client instance after removing it from manager",
client1, mSSMgr.getClientFor(mValidAccount, getContext()));
} catch (Exception e) {
throw new AssertionFailedError("Exception getting client for account: " + e.getMessage());
}
// TODO harder tests
}