### Question:
Counter extends AbstractMetric<Long> implements SettableMetric<Long>, IncrementableMetric { @VisibleForTesting void incrementBy(long offset, Instant startTimestamp, ImmutableList<String> labelValues) { Lock lock = valueLocks.get(labelValues); lock.lock(); try { values.addAndGet(labelValues, offset); valueStartTimestamps.putIfAbsent(labelValues, startTimestamp); } finally { lock.unlock(); } } Counter(
      String name,
      String description,
      String valueDisplayName,
      ImmutableSet<LabelDescriptor> labels); @Override final void incrementBy(long offset, String... labelValues); @Override final void increment(String... labelValues); @Override final ImmutableList<MetricPoint<Long>> getTimestampedValues(); @Override final int getCardinality(); @Override final void set(Long value, String... labelValues); @Override final void reset(); @Override final void reset(String... labelValues);  }### Answer:
@Test public void testIncrementBy_negativeOffset_throwsException() { Counter counter = new Counter( "/metric", "description", "vdn", ImmutableSet.of(LabelDescriptor.create("label1", "bar"))); IllegalArgumentException thrown = assertThrows(IllegalArgumentException.class, () -> counter.incrementBy(-1L, "foo")); assertThat(thrown).hasMessageThat().contains("The offset provided must be non-negative"); }