Flags { public static int getPersistenceFlag(int flags, boolean warnFallback) { int persistencePriority = flags & PERSISTENCE_MASK; if (persistencePriority != NORMAL && persistencePriority != CRITICAL) { if (persistencePriority != 0 && warnFallback) { AppCenterLog.warn(LOG_TAG, "Invalid value=" + persistencePriority + " for persistence flag, using NORMAL as a default."); } persistencePriority = NORMAL; } return persistencePriority; }  static int getPersistenceFlag(int flags, boolean warnFallback); static final int NORMAL; @Deprecated
    static final int PERSISTENCE_NORMAL; static final int CRITICAL; @Deprecated
    static final int PERSISTENCE_CRITICAL; static final int DEFAULTS; }
@Test public void persistenceNone() { assertEquals(Flags.NORMAL, Flags.getPersistenceFlag(0, false)); assertEquals(Flags.NORMAL, Flags.getPersistenceFlag(0, true)); verifyStatic(never()); AppCenterLog.warn(anyString(), anyString()); }
@Test public void persistenceNormal() { assertEquals(Flags.NORMAL, Flags.getPersistenceFlag(Flags.NORMAL, false)); assertEquals(Flags.NORMAL, Flags.getPersistenceFlag(Flags.NORMAL, true)); verifyStatic(never()); AppCenterLog.warn(anyString(), anyString()); }
@Test public void persistenceCritical() { assertEquals(Flags.CRITICAL, Flags.getPersistenceFlag(Flags.CRITICAL, false)); assertEquals(Flags.CRITICAL, Flags.getPersistenceFlag(Flags.CRITICAL, true)); verifyStatic(never()); AppCenterLog.warn(anyString(), anyString()); }
@SuppressWarnings("deprecation") @Test public void persistenceBackwardCompatible() { assertEquals(Flags.NORMAL, Flags.getPersistenceFlag(Flags.PERSISTENCE_NORMAL, true)); assertEquals(Flags.CRITICAL, Flags.getPersistenceFlag(Flags.PERSISTENCE_CRITICAL, true)); verifyStatic(never()); AppCenterLog.warn(anyString(), anyString()); }
@Test public void persistenceDefaults() { assertEquals(Flags.NORMAL, Flags.getPersistenceFlag(Flags.DEFAULTS, false)); assertEquals(Flags.NORMAL, Flags.getPersistenceFlag(Flags.DEFAULTS, true)); verifyStatic(never()); AppCenterLog.warn(anyString(), anyString()); }
@Test public void persistenceCriticalPlusOtherFlag() { assertEquals(Flags.CRITICAL, Flags.getPersistenceFlag(Flags.CRITICAL | 0x0100, false)); assertEquals(Flags.CRITICAL, Flags.getPersistenceFlag(Flags.CRITICAL | 0x0200, true)); verifyStatic(never()); AppCenterLog.warn(anyString(), anyString()); }
@Test public void persistenceInvalidFlag() { assertEquals(Flags.NORMAL, Flags.getPersistenceFlag(0x09, false)); verifyStatic(never()); AppCenterLog.warn(anyString(), anyString()); assertEquals(Flags.NORMAL, Flags.getPersistenceFlag(0x09, true)); verifyStatic(); AppCenterLog.warn(anyString(), anyString()); }