@Test public void testGetAvailableMeasurementNamesWithException() throws ComponentLookupException { ComponentManager cm = this.mocker.getInstance(ComponentManager.class, "context"); when(cm.getInstanceMap(MeasurementHandler.class)).thenThrow(new ComponentLookupException("")); Set<String> response = this.mocker.getComponentUnderTest().getAvailableMeasurementNames(); Assert.assertNotNull(response); Assert.assertTrue(response.isEmpty()); }
public Set<String> getAvailableMeasurementNames() { try { Map<String, MeasurementHandler> handlers = this.componentManager.get().getInstanceMap(MeasurementHandler.class); if (handlers != null) { Set<String> result = new TreeSet<>(MeasurementNameSorter.instance); result.addAll(handlers.keySet()); return result; } } catch (ComponentLookupException ex) { this.logger.warn("Failed to list available measurement types", ex); } return Collections.emptySet(); }
MeasurementsScriptService implements ScriptService { public Set<String> getAvailableMeasurementNames() { try { Map<String, MeasurementHandler> handlers = this.componentManager.get().getInstanceMap(MeasurementHandler.class); if (handlers != null) { Set<String> result = new TreeSet<>(MeasurementNameSorter.instance); result.addAll(handlers.keySet()); return result; } } catch (ComponentLookupException ex) { this.logger.warn("Failed to list available measurement types", ex); } return Collections.emptySet(); } }
MeasurementsScriptService implements ScriptService { public Set<String> getAvailableMeasurementNames() { try { Map<String, MeasurementHandler> handlers = this.componentManager.get().getInstanceMap(MeasurementHandler.class); if (handlers != null) { Set<String> result = new TreeSet<>(MeasurementNameSorter.instance); result.addAll(handlers.keySet()); return result; } } catch (ComponentLookupException ex) { this.logger.warn("Failed to list available measurement types", ex); } return Collections.emptySet(); }  }
MeasurementsScriptService implements ScriptService { public Set<String> getAvailableMeasurementNames() { try { Map<String, MeasurementHandler> handlers = this.componentManager.get().getInstanceMap(MeasurementHandler.class); if (handlers != null) { Set<String> result = new TreeSet<>(MeasurementNameSorter.instance); result.addAll(handlers.keySet()); return result; } } catch (ComponentLookupException ex) { this.logger.warn("Failed to list available measurement types", ex); } return Collections.emptySet(); }  MeasurementHandler get(String measurementType); List<MeasurementHandler> getAvailableMeasurementHandlers(); Set<String> getAvailableMeasurementNames(); String getFuzzyValue(int percentile); String getFuzzyValue(double deviation); }
MeasurementsScriptService implements ScriptService { public Set<String> getAvailableMeasurementNames() { try { Map<String, MeasurementHandler> handlers = this.componentManager.get().getInstanceMap(MeasurementHandler.class); if (handlers != null) { Set<String> result = new TreeSet<>(MeasurementNameSorter.instance); result.addAll(handlers.keySet()); return result; } } catch (ComponentLookupException ex) { this.logger.warn("Failed to list available measurement types", ex); } return Collections.emptySet(); }  MeasurementHandler get(String measurementType); List<MeasurementHandler> getAvailableMeasurementHandlers(); Set<String> getAvailableMeasurementNames(); String getFuzzyValue(int percentile); String getFuzzyValue(double deviation);  }