@Test(expected = NullPointerException.class) public void testRemoveNullSensor() { String groupName = "doesNotMatter"; Map<String, String> tags = new HashMap<>(); StreamsMetricsImpl streamsMetrics = new StreamsMetricsImpl(new Metrics(), groupName, tags); streamsMetrics.removeSensor(null); }
@Override public void removeSensor(Sensor sensor) { Sensor parent = null; Objects.requireNonNull(sensor, "Sensor is null"); metrics.removeSensor(sensor.name()); parent = parentSensors.get(sensor); if (parent != null) { metrics.removeSensor(parent.name()); } }
StreamsMetricsImpl implements StreamsMetrics { @Override public void removeSensor(Sensor sensor) { Sensor parent = null; Objects.requireNonNull(sensor, "Sensor is null"); metrics.removeSensor(sensor.name()); parent = parentSensors.get(sensor); if (parent != null) { metrics.removeSensor(parent.name()); } } }
StreamsMetricsImpl implements StreamsMetrics { @Override public void removeSensor(Sensor sensor) { Sensor parent = null; Objects.requireNonNull(sensor, "Sensor is null"); metrics.removeSensor(sensor.name()); parent = parentSensors.get(sensor); if (parent != null) { metrics.removeSensor(parent.name()); } } StreamsMetricsImpl(Metrics metrics, String groupName,  Map<String, String> tags); }
StreamsMetricsImpl implements StreamsMetrics { @Override public void removeSensor(Sensor sensor) { Sensor parent = null; Objects.requireNonNull(sensor, "Sensor is null"); metrics.removeSensor(sensor.name()); parent = parentSensors.get(sensor); if (parent != null) { metrics.removeSensor(parent.name()); } } StreamsMetricsImpl(Metrics metrics, String groupName,  Map<String, String> tags); Metrics registry(); @Override Sensor addSensor(String name, Sensor.RecordingLevel recordingLevel); @Override Sensor addSensor(String name, Sensor.RecordingLevel recordingLevel, Sensor... parents); @Override Map<MetricName, ? extends Metric> metrics(); @Override void recordLatency(Sensor sensor, long startNs, long endNs); @Override void recordThroughput(Sensor sensor, long value); @Override Sensor addLatencyAndThroughputSensor(String scopeName, String entityName, String operationName, Sensor.RecordingLevel recordingLevel, String... tags); @Override Sensor addThroughputSensor(String scopeName, String entityName, String operationName, Sensor.RecordingLevel recordingLevel, String... tags); void measureLatencyNs(final Time time, final Runnable action, final Sensor sensor); @Override void removeSensor(Sensor sensor); }
StreamsMetricsImpl implements StreamsMetrics { @Override public void removeSensor(Sensor sensor) { Sensor parent = null; Objects.requireNonNull(sensor, "Sensor is null"); metrics.removeSensor(sensor.name()); parent = parentSensors.get(sensor); if (parent != null) { metrics.removeSensor(parent.name()); } } StreamsMetricsImpl(Metrics metrics, String groupName,  Map<String, String> tags); Metrics registry(); @Override Sensor addSensor(String name, Sensor.RecordingLevel recordingLevel); @Override Sensor addSensor(String name, Sensor.RecordingLevel recordingLevel, Sensor... parents); @Override Map<MetricName, ? extends Metric> metrics(); @Override void recordLatency(Sensor sensor, long startNs, long endNs); @Override void recordThroughput(Sensor sensor, long value); @Override Sensor addLatencyAndThroughputSensor(String scopeName, String entityName, String operationName, Sensor.RecordingLevel recordingLevel, String... tags); @Override Sensor addThroughputSensor(String scopeName, String entityName, String operationName, Sensor.RecordingLevel recordingLevel, String... tags); void measureLatencyNs(final Time time, final Runnable action, final Sensor sensor); @Override void removeSensor(Sensor sensor);  }