ConfigurationService { public int getShardingTotalCount() { String result = jobNodeStorage.getJobNodeDataDirectly(ConfigurationNode.SHARDING_TOTAL_COUNT); return Strings.isNullOrEmpty(result) ? -1 : Integer.parseInt(result); } ConfigurationService(final CoordinatorRegistryCenter coordinatorRegistryCenter, final JobConfiguration jobConfiguration); void persistJobConfiguration(); int getShardingTotalCount(); Map<Integer, String> getShardingItemParameters(); String getJobParameter(); String getCron(); boolean isMonitorExecution(); int getProcessCountIntervalSeconds(); int getConcurrentDataProcessThreadCount(); int getFetchDataCount(); void checkMaxTimeDiffSecondsTolerable(); boolean isFailover(); boolean isMisfire(); String getJobShardingStrategyClass(); int getMonitorPort(); String getJobName(); boolean inSkipTime(Date now);  }
@Test public void assertGetShardingTotalCount() { when(jobNodeStorage.getJobNodeDataDirectly(ConfigurationNode.SHARDING_TOTAL_COUNT)).thenReturn("3"); assertThat(configService.getShardingTotalCount(), is(3)); verify(jobNodeStorage).getJobNodeDataDirectly(ConfigurationNode.SHARDING_TOTAL_COUNT); }
@Test public void assertGetShardingTotalCountWhenNodeIsNotExisted() { assertThat(configService.getShardingTotalCount(), is(-1)); verify(jobNodeStorage).getJobNodeDataDirectly(ConfigurationNode.SHARDING_TOTAL_COUNT); }