@Override public void add(double amount) { get().add(amount); }
/** * Update the counter by {@code amount}. * * @param amount * Amount to add to the counter. */ default void increment(long amount) { add(amount); }
@Override public void add(double amount) { for (Counter c : meters) { c.add(amount); } }
/** * Update the counter by {@code amount}. * * @param amount * Amount to add to the counter. */ default void increment(long amount) { add(amount); }
@Override public void add(double amount) { for (Counter c : meters) { c.add(amount); } }
/** Update the counter by one. */ default void increment() { add(1.0); }
/** Update the counter by one. */ default void increment() { add(1.0); }
@Override public void add(double amount) { counter.add(amount); lastUpdated.set(clock.wallTime()); }
@Override public void add(double amount) { counter.add(amount); lastUpdated.set(clock.wallTime()); }
@Override public void add(double amount) { get().add(amount); }
@Override public void add(double amount) { resolveToCurrentMeter().add(amount); }
@Override public void add(double amount) { get().add(amount); }
@Override public void add(double amount) { get().add(amount); }
@Test public void testAddInfinity() { Counter c = new DefaultCounter(clock, NoopId.INSTANCE); c.add(Double.POSITIVE_INFINITY); Assertions.assertEquals(c.actualCount(), 0.0, 1e-12); }
@Test public void testAddNegativeAmount() { Counter c = new DefaultCounter(clock, NoopId.INSTANCE); c.add(-42.0); Assertions.assertEquals(c.actualCount(), 0.0, 1e-12); }
@Test public void testAddAmount() { Counter c = new DefaultCounter(clock, NoopId.INSTANCE); c.add(42.0); Assertions.assertEquals(c.actualCount(), 42.0, 1e-12); }
@Test public void counterAdd() { Counter c = registry.counter("foo"); Assertions.assertEquals(0.0, c.actualCount(), 1e-12); c.add(1.5); Assertions.assertEquals(1.5, c.actualCount(), 1e-12); }