-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Contribute
To get started, sign the Contributor License Agreement.
JMH benchmarks can be run using
gradlew jmh -PincludePattern=[class-name pattern]
JOL inspectors can be run using
gradlew [object-layout task] -PclassName=[class-name]
For convenience, the project's package is prepended to the supplied class name.
Static code analysis tasks are not enabled by default and can be run using
gradlew clean build -Dcheckstyle -Dfindbugs -Dpmd
Cache unit tests can opt into being run against all cache configurations that meet a specification
constraint. A test method annotated with a configured @CacheSpec
and using the CacheProvider
will be executed with all possible combinations. The test case can inspect the execution
configuration by accepting the CacheContext
as a parameter.
Parameterized tests can take advantage of automatic validation of the cache's internal data
structures to detect corruption. The CacheValidationListener
is run after a successful test case
and if an error is detected then the test is set with the failure information.
@Listeners(CacheValidationListener.class)
@Test(dataProviderClass = CacheProvider.class)
public final class CacheTest {
@CacheSpec(
keys = { ReferenceType.STRONG, ReferenceType.WEAK },
values = { ReferenceType.STRONG, ReferenceType.WEAK, ReferenceType.SOFT },
maximumSize = { MaximumSize.DISABLED, MaximumSize.FULL, MaximumSize.UNREACHABLE })
@Test(dataProvider = "caches")
public void getIfPresent_notFound(
Cache<Integer, Integer> cache, CacheContext context) {
// This test is run against at least 72 different cache configurations
// (2 key types) * (3 value types) * (3 max sizes) * (4 population modes)
assertThat(cache.getIfPresent(context.getAbsentKey()), is(nullValue());
assertThat(cache.stats(), both(hasMissCount(1)).and(hasHitCount(0)));
}
}
YourKit supports open source projects with its full-featured Java Profiler.