Skip to content

Commit

Permalink
testing polish
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-manes committed Dec 31, 2024
1 parent 02349cf commit bd45ce7
Show file tree
Hide file tree
Showing 55 changed files with 433 additions and 402 deletions.
18 changes: 9 additions & 9 deletions caffeine/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,30 +32,30 @@ dependencies {
api(libs.jspecify)
api(libs.errorprone.annotations)

testImplementation(libs.joor)
testImplementation(libs.ycsb) {
isTransitive = false
}
testImplementation(libs.picocli)
testImplementation(libs.jctools)
testImplementation(libs.fastutil)
testImplementation(libs.mockito)
testImplementation(libs.picocli)
testImplementation(libs.lincheck)
testImplementation(libs.commons.lang3)
testImplementation(libs.guava.testlib)
testImplementation(libs.bundles.jazzer)
testImplementation(libs.bundles.awaitility)
testImplementation(libs.bundles.slf4j.test)
testImplementation(libs.commons.collections4)
testImplementation(libs.commons.collections4) {
artifact {
classifier = "tests"
}
artifact { classifier = "tests" }
}
testImplementation(sourceSets["codeGen"].output)
testImplementation(libs.bundles.osgi.test.compile)
testImplementation(libs.eclipse.collections.testutils)

testRuntimeOnly(libs.bundles.osgi.test.runtime)

collections4Sources(libs.commons.collections4) {
artifact {
classifier = "test-sources"
}
artifact { classifier = "test-sources" }
}

jammAgent(libs.jamm) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import static com.google.common.truth.Truth.assertThat;
import static java.util.Objects.requireNonNull;
import static java.util.function.Function.identity;
import static org.junit.Assert.assertThrows;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import static com.google.common.truth.Truth.assertThat;
import static java.util.Objects.requireNonNull;
import static java.util.function.Function.identity;
import static org.junit.Assert.assertThrows;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import static com.google.common.truth.Truth.assertThat;
import static java.util.Objects.requireNonNull;
import static java.util.function.Function.identity;
import static org.junit.Assert.assertThrows;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ public void getAll_absent_partial(AsyncLoadingCache<Int, Int> cache, CacheContex
var expect = new ImmutableMap.Builder<Int, Int>()
.putAll(Maps.toMap(context.firstMiddleLastKeys(), Int::negate))
.putAll(Maps.toMap(context.absentKeys(), Int::negate))
.build();
.buildOrThrow();
var result = cache.getAll(expect.keySet()).join();
assertThat(result).isEqualTo(expect);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.Assert.assertThrows;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyLong;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import static com.google.common.truth.Truth.assertWithMessage;
import static java.util.Objects.requireNonNull;
import static java.util.function.Function.identity;
import static org.junit.Assert.assertThrows;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.times;
Expand Down Expand Up @@ -503,7 +503,7 @@ public void getAll_exceeds(Cache<Int, Int> cache, CacheContext context) {
var expected = new ImmutableMap.Builder<Int, Int>()
.putAll(context.original())
.putAll(context.absent())
.build();
.buildOrThrow();
assertThat(cache).containsExactlyEntriesIn(expected);
assertThat(context).stats().hits(0).misses(result.size()).success(1).failures(0);
assertThat(result).containsExactlyEntriesIn(Map.of(context.absentKey(), context.absentValue()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import static com.github.benmanes.caffeine.cache.Caffeine.UNSET_INT;
import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.assertThrows;
import static org.junit.jupiter.api.Assertions.assertThrows;

import java.time.Duration;
import java.util.concurrent.TimeUnit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import static com.google.common.truth.Truth.assertThat;
import static java.util.Locale.US;
import static java.util.Objects.requireNonNull;
import static org.junit.Assert.assertThrows;
import static org.junit.jupiter.api.Assertions.assertThrows;

import java.time.Duration;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import static com.github.benmanes.caffeine.testing.LoggingEvents.logEvents;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.util.concurrent.MoreExecutors.directExecutor;
import static org.junit.Assert.assertThrows;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.Mockito.verify;
import static org.slf4j.event.Level.WARN;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import static com.google.common.collect.ImmutableMap.toImmutableMap;
import static com.google.common.truth.Truth.assertThat;
import static java.util.function.Function.identity;
import static org.junit.Assert.assertThrows;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when;
import static org.slf4j.event.Level.WARN;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import static com.google.common.base.Functions.identity;
import static com.google.common.truth.Truth.assertThat;
import static java.util.Map.entry;
import static org.junit.Assert.assertThrows;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.ArgumentMatchers.eq;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import static com.google.common.collect.ImmutableMap.toImmutableMap;
import static com.google.common.truth.Truth.assertThat;
import static java.util.Objects.requireNonNull;
import static org.junit.Assert.assertThrows;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.slf4j.event.Level.WARN;

import java.time.Duration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import static com.google.common.truth.Truth.assertThat;
import static java.util.Objects.requireNonNull;
import static java.util.function.Function.identity;
import static org.junit.Assert.assertThrows;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.Mockito.times;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import static com.google.common.collect.ImmutableMap.toImmutableMap;
import static com.google.common.truth.Truth.assertThat;
import static java.util.Objects.requireNonNull;
import static org.junit.Assert.assertThrows;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.slf4j.event.Level.WARN;

import java.time.Duration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
package com.github.benmanes.caffeine.cache;

import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.assertThrows;
import static org.junit.jupiter.api.Assertions.assertThrows;

import java.util.concurrent.ThreadLocalRandom;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import static com.github.benmanes.caffeine.testing.MapSubject.assertThat;
import static com.google.common.truth.Truth.assertAbout;
import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.assertThrows;
import static org.junit.jupiter.api.Assertions.assertThrows;

import java.lang.ref.WeakReference;
import java.util.Arrays;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import static com.google.common.collect.Iterators.elementsEqual;
import static com.google.common.truth.Truth.assertThat;
import static java.util.Objects.requireNonNull;
import static org.junit.Assert.assertThrows;
import static org.junit.jupiter.api.Assertions.assertThrows;

import java.util.ArrayList;
import java.util.Collection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import static com.google.common.truth.Truth.assertThat;
import static java.util.Objects.requireNonNull;
import static java.util.function.Function.identity;
import static org.junit.Assert.assertThrows;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.slf4j.event.Level.TRACE;
import static org.slf4j.event.Level.WARN;

Expand Down Expand Up @@ -300,7 +300,7 @@ public void getAll_absent_partial(LoadingCache<Int, Int> cache, CacheContext con
var expect = new ImmutableMap.Builder<Int, Int>()
.putAll(Maps.toMap(context.firstMiddleLastKeys(), Int::negate))
.putAll(Maps.toMap(context.absentKeys(), Int::negate))
.build();
.buildOrThrow();
var result = cache.getAll(expect.keySet());
assertThat(result).isEqualTo(expect);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ private void checkEvictionDeque(BoundedLocalCache<Object, Object> bounded) {
.put("probation", mainProbation, bounded.accessOrderProbationDeque())
.put("protected", bounded.mainProtectedWeightedSize(),
bounded.accessOrderProtectedDeque())
.build();
.buildOrThrow();
checkLinks(bounded, deques);
check("accessOrderWindowDeque()").about(deque())
.that(bounded.accessOrderWindowDeque()).isValid();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import static com.github.benmanes.caffeine.testing.Awaits.await;
import static com.google.common.truth.Truth.assertThat;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThrows;
import static org.junit.jupiter.api.Assertions.assertThrows;

import java.util.concurrent.atomic.AtomicInteger;

Expand Down
Loading

0 comments on commit bd45ce7

Please sign in to comment.