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

Added unit test for OwnCloudClientManagerFactory

This commit is contained in:
David A. Velasco
2014-06-17 14:12:30 +02:00
parent 2e4fc047af
commit c01001b5a1
2 changed files with 164 additions and 2 deletions
@@ -7,7 +7,7 @@ public class OwnCloudClientManagerFactory {
SINGLE_SESSION_PER_ACCOUNT
}
public static Policy sDefaultPolicy = Policy.ALWAYS_NEW_CLIENT;
private static Policy sDefaultPolicy = Policy.ALWAYS_NEW_CLIENT;
private static OwnCloudClientManager sDefaultSingleton;
@@ -35,13 +35,20 @@ public class OwnCloudClientManagerFactory {
return sDefaultSingleton;
}
public static Policy getDefaultPolicy() {
return sDefaultPolicy;
}
public static void setDefaultPolicy(Policy policy) {
if (policy == null) {
throw new IllegalArgumentException("Default policy cannot be NULL");
}
if (defaultSingletonMustBeUpdated(policy)) {
sDefaultSingleton = null;
}
sDefaultPolicy = policy;
}
private static boolean defaultSingletonMustBeUpdated(Policy policy) {
if (sDefaultSingleton == null) {
return false;