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:
+18
-10
@@ -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
|
||||
}
|
||||
|
||||
|
||||
+21
-12
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user