本文整理汇总了Java中com.owncloud.android.lib.common.OwnCloudClientManagerFactory.getDefaultPolicy方法的典型用法代码示例。如果您正苦于以下问题:Java OwnCloudClientManagerFactory.getDefaultPolicy方法的具体用法?Java OwnCloudClientManagerFactory.getDefaultPolicy怎么用?Java OwnCloudClientManagerFactory.getDefaultPolicy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.owncloud.android.lib.common.OwnCloudClientManagerFactory
的用法示例。
在下文中一共展示了OwnCloudClientManagerFactory.getDefaultPolicy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSetDefaultPolicy
import com.owncloud.android.lib.common.OwnCloudClientManagerFactory; //导入方法依赖的package包/类
public void testSetDefaultPolicy() {
OwnCloudClientManagerFactory.setDefaultPolicy(Policy.SINGLE_SESSION_PER_ACCOUNT);
Policy defaultPolicy = OwnCloudClientManagerFactory.getDefaultPolicy();
assertEquals("SINGLE_SESSION_PER_ACCOUNT not set",
Policy.SINGLE_SESSION_PER_ACCOUNT, defaultPolicy);
OwnCloudClientManagerFactory.setDefaultPolicy(Policy.ALWAYS_NEW_CLIENT);
defaultPolicy = OwnCloudClientManagerFactory.getDefaultPolicy();
assertEquals("ALWAYS_NEW_CLIENT not set", Policy.ALWAYS_NEW_CLIENT, defaultPolicy);
try {
OwnCloudClientManagerFactory.setDefaultPolicy(null);
throw new AssertionFailedError("Accepted NULL parameter");
} catch(Exception e) {
assertTrue("Unexpected exception when setting default policy null",
(e instanceof IllegalArgumentException));
}
defaultPolicy = OwnCloudClientManagerFactory.getDefaultPolicy();
assertEquals("ALWAYS_NEW_CLIENT changed after setting null",
Policy.ALWAYS_NEW_CLIENT, defaultPolicy);
}
示例2: testGetDefaultPolicy
import com.owncloud.android.lib.common.OwnCloudClientManagerFactory; //导入方法依赖的package包/类
public void testGetDefaultPolicy() {
Policy defaultPolicy = OwnCloudClientManagerFactory.getDefaultPolicy();
assertNotNull("Returned null value", defaultPolicy);
assertTrue("Returned unknown value",
(Policy.ALWAYS_NEW_CLIENT.equals(defaultPolicy) ||
(Policy.SINGLE_SESSION_PER_ACCOUNT.equals(defaultPolicy))));
}