@Test public void defaultStrategyIsNeverFlush() { FlushStrategy strategy = createFlushStrategy(null, null); assertThat(strategy).isInstanceOf(NeverFlush.class); }
@Nonnull public static FlushStrategy createFlushStrategy(@Nullable String strategy, @Nullable Integer flushDelayInSeconds) { if (strategy == null) return new NeverFlush(); if (strategy.equals("never")) return new NeverFlush(); if (strategy.equals("always")) return new AlwaysFlush(); if (strategy.equals("timeBased")) { if (flushDelayInSeconds == null) throw new IllegalArgumentException("flushDelayInSeconds cannot be null"); return new TimeBasedFlush(new SystemClock(), flushDelayInSeconds, SECONDS); } throw new IllegalArgumentException( format("Strategy %s is not valid, supported values are 'never', 'always' and 'timeBased'", strategy)); }
FlushStrategyUtils { @Nonnull public static FlushStrategy createFlushStrategy(@Nullable String strategy, @Nullable Integer flushDelayInSeconds) { if (strategy == null) return new NeverFlush(); if (strategy.equals("never")) return new NeverFlush(); if (strategy.equals("always")) return new AlwaysFlush(); if (strategy.equals("timeBased")) { if (flushDelayInSeconds == null) throw new IllegalArgumentException("flushDelayInSeconds cannot be null"); return new TimeBasedFlush(new SystemClock(), flushDelayInSeconds, SECONDS); } throw new IllegalArgumentException( format("Strategy %s is not valid, supported values are 'never', 'always' and 'timeBased'", strategy)); } }
FlushStrategyUtils { @Nonnull public static FlushStrategy createFlushStrategy(@Nullable String strategy, @Nullable Integer flushDelayInSeconds) { if (strategy == null) return new NeverFlush(); if (strategy.equals("never")) return new NeverFlush(); if (strategy.equals("always")) return new AlwaysFlush(); if (strategy.equals("timeBased")) { if (flushDelayInSeconds == null) throw new IllegalArgumentException("flushDelayInSeconds cannot be null"); return new TimeBasedFlush(new SystemClock(), flushDelayInSeconds, SECONDS); } throw new IllegalArgumentException( format("Strategy %s is not valid, supported values are 'never', 'always' and 'timeBased'", strategy)); } private  FlushStrategyUtils(); }
FlushStrategyUtils { @Nonnull public static FlushStrategy createFlushStrategy(@Nullable String strategy, @Nullable Integer flushDelayInSeconds) { if (strategy == null) return new NeverFlush(); if (strategy.equals("never")) return new NeverFlush(); if (strategy.equals("always")) return new AlwaysFlush(); if (strategy.equals("timeBased")) { if (flushDelayInSeconds == null) throw new IllegalArgumentException("flushDelayInSeconds cannot be null"); return new TimeBasedFlush(new SystemClock(), flushDelayInSeconds, SECONDS); } throw new IllegalArgumentException( format("Strategy %s is not valid, supported values are 'never', 'always' and 'timeBased'", strategy)); } private  FlushStrategyUtils(); @Nonnull static FlushStrategy createFlushStrategy(@Nullable String strategy, @Nullable Integer flushDelayInSeconds); }
FlushStrategyUtils { @Nonnull public static FlushStrategy createFlushStrategy(@Nullable String strategy, @Nullable Integer flushDelayInSeconds) { if (strategy == null) return new NeverFlush(); if (strategy.equals("never")) return new NeverFlush(); if (strategy.equals("always")) return new AlwaysFlush(); if (strategy.equals("timeBased")) { if (flushDelayInSeconds == null) throw new IllegalArgumentException("flushDelayInSeconds cannot be null"); return new TimeBasedFlush(new SystemClock(), flushDelayInSeconds, SECONDS); } throw new IllegalArgumentException( format("Strategy %s is not valid, supported values are 'never', 'always' and 'timeBased'", strategy)); } private  FlushStrategyUtils(); @Nonnull static FlushStrategy createFlushStrategy(@Nullable String strategy, @Nullable Integer flushDelayInSeconds);  }