Collector { private Counter getRangeCounter(Range range, Counter dayCounter) throws IOException { final PeriodCounterFactory periodCounterFactory = new PeriodCounterFactory(dayCounter); final Counter counter; if (range.getPeriod() == null) { counter = periodCounterFactory.getCustomCounter(range); } else { switch (range.getPeriod()) { case JOUR: counter = periodCounterFactory.getDayCounter(); break; case SEMAINE: counter = periodCounterFactory.getWeekCounter(); break; case MOIS: counter = periodCounterFactory.getMonthCounter(); break; case ANNEE: counter = periodCounterFactory.getYearCounter(); break; case TOUT: throw new IllegalStateException(range.getPeriod().toString()); default: throw new IllegalArgumentException(range.getPeriod().toString()); } } return counter; } Collector(String application, List<Counter> counters);  Collector(String application, List<Counter> counters,
			SamplingProfiler samplingProfiler); String getApplication(); SamplingProfiler getSamplingProfiler(); List<SampledMethod> getHotspots(); Map<String, Date> getDatesByWebappVersions(); List<Counter> getCounters(); Counter getCounterByName(String counterName); Counter getCounterByRequestId(CounterRequest request); List<CounterRequestContext> getRootCurrentContexts(List<Counter> newParentCounters); long getLastCollectDuration(); Throwable getLastCollectorException(); long getEstimatedMemorySize(); long getDiskUsage(); List<Counter> getRangeCounters(Range range); List<Counter> getRangeCountersToBeDisplayed(Range range); Counter getRangeCounter(Range range, String counterName); void collectLocalContextWithoutErrors(); void collectWithoutErrors(List<JavaInformations> javaInformationsList); JRobin getJRobin(String graphName); Collection<JRobin> getCounterJRobins(); Collection<JRobin> getDisplayedCounterJRobins(); Collection<JRobin> getDisplayedOtherJRobins(); boolean isStorageUsedByMultipleInstances(); void stop(); boolean isStopped(); static void stopJRobin(); static void detachVirtualMachine(); @Override String toString();  }
@Test public void testGetRangeCounter() throws IOException { final Counter counter = createCounter(); final Counter counter2 = new Counter("sql", null); final Collector collector = new Collector(TEST, Arrays.asList(counter, counter2)); collector.getRangeCounter(Period.JOUR.getRange(), counter2.getName()); collector.getRangeCounter(Period.TOUT.getRange(), counter2.getName()); try { collector.getRangeCounter(Period.TOUT.getRange(), "unknown"); } catch (final IllegalArgumentException e) { assertNotNull("getRangeCounter", e); } }