BizConfig extends RefreshableConfig { int checkInt(int value, int min, int max, int defaultValue) { if (value >= min && value <= max) { return value; } return defaultValue; } BizConfig(final BizDBPropertySource propertySource); List<String> eurekaServiceUrls(); int grayReleaseRuleScanInterval(); long longPollingTimeoutInMilli(); int itemKeyLengthLimit(); int itemValueLengthLimit(); Map<Long, Integer> namespaceValueLengthLimitOverride(); boolean isNamespaceLockSwitchOff(); String cloggingUrl(); String cloggingPort(); int appNamespaceCacheScanInterval(); TimeUnit appNamespaceCacheScanIntervalTimeUnit(); int appNamespaceCacheRebuildInterval(); TimeUnit appNamespaceCacheRebuildIntervalTimeUnit(); int accessKeyCacheScanInterval(); TimeUnit accessKeyCacheScanIntervalTimeUnit(); int accessKeyCacheRebuildInterval(); TimeUnit accessKeyCacheRebuildIntervalTimeUnit(); int releaseMessageCacheScanInterval(); TimeUnit releaseMessageCacheScanIntervalTimeUnit(); int releaseMessageScanIntervalInMilli(); int releaseMessageNotificationBatch(); int releaseMessageNotificationBatchIntervalInMilli(); boolean isConfigServiceCacheEnabled(); boolean isAdminServiceAccessControlEnabled(); String getAdminServiceAccessTokens();  }
@Test public void testCheckInt() throws Exception { int someInvalidValue = 1; int anotherInvalidValue = 2; int someValidValue = 3; int someDefaultValue = 10; int someMin = someInvalidValue + 1; int someMax = anotherInvalidValue - 1; assertEquals(someDefaultValue, bizConfig.checkInt(someInvalidValue, someMin, Integer.MAX_VALUE, someDefaultValue)); assertEquals(someDefaultValue, bizConfig.checkInt(anotherInvalidValue, Integer.MIN_VALUE, someMax, someDefaultValue)); assertEquals(someValidValue, bizConfig.checkInt(someValidValue, Integer.MIN_VALUE, Integer.MAX_VALUE, someDefaultValue)); }