• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ben-manes / caffeine / #5400
100%
master: 100%

Build:
Build:
LAST BUILD BRANCH: v3.dev
DEFAULT BRANCH: master
Ran 22 Apr 2026 05:02AM UTC
Jobs 1
Files 78
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

22 Apr 2026 04:35AM UTC coverage: 100.0%. Remained the same
#5400

push

github

ben-manes
Auto-assert eviction stats alongside notifications.withCause.exclusively

A recent audit caught that put/remove/clear paths weren't recording
eviction stats when the old entry had already been evicted (fixed in
5bb78f0f9). The bug lived because the ~100 parameterized tests that
already asserted on the eviction notification via

  assertThat(context).notifications().withCause(EXPIRED|COLLECTED|SIZE)
      .contains(...).exclusively();

all skipped the sibling

  assertThat(context).stats().evictions(N).evictionWeight(W);

so only a small handful of tests (~9 across EvictionTest / ReferenceTest /
BoundedLocalCacheTest) exercised the stats counters for eviction-cause
removals. The asymmetry was silent — the cause-based notification and the
stats counters were three observations of the same logical event and
nothing forced them to agree.

Fold both stats checks into the Exclusive.exclusively() subject: when the
cause wasEvicted(), assert evictionCount == entries.length AND
evictionWeight == sum of context.weigher().weigh(k, v) over the entries.
Null values (which the listener may receive on COLLECTED with cleared
weak/soft refs) are treated as weight 0 to avoid NPE in user weighers.

Also fold the symmetric "no evictions" check into ListenerSubject.isEmpty()
and ListenerSubject.hasNoEvictions(): both paths now also assert
evictions(0).evictionWeight(0).

When stats recording is disabled for a parameterization,
StatsSubject.awaitStatistic short-circuits to a no-op, so no-stats runs
are unaffected. This closes the gap for every existing eviction-cause
assertion and prevents future tests from reproducing the same blind spot.

3921 of 3928 branches covered (99.82%)

8014 of 8014 relevant lines covered (100.0%)

1.0 hits per line

Jobs
ID Job ID Ran Files Coverage
1 #5400.1 22 Apr 2026 05:02AM UTC 78
100.0
Source Files on build #5400
  • Tree
  • List 78
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • f94c0113 on github
  • Prev Build on v3.dev
  • Next Build on v3.dev
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc