geode-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kirk Lund <kl...@apache.org>
Subject [DISCUSS] Replace @TestingOnly with @VisibleForTesting
Date Mon, 17 Dec 2018 20:22:34 GMT
We have a custom annotation in geode-common called @TestingOnly:

geode-common/src/main/java/org/apache/geode/annotations/TestingOnly.java

This annotation was created while pairing with Michael Feathers and the
intention was to annotate non-private constructors or methods that have a
widened visibility scope to facilitate testing.

Some developers, however, have interpreted it as meaning that the
constructor or method cannot be used in the main src code and can only be
used from test src code.

I'd like to propose deleting @TestingOnly and change to
using @VisibleForTesting which is defined in Guava (which is already a
Geode dependency). The name of the Guava annotation is less ambiguous and
it's already been adopted for use by additional projects including AssertJ
which we use extensively.

The javadocs on VisibleForTesting explains its usage very clearly:

/**
 * Annotates a program element that exists, or is more widely visible
than otherwise necessary, only
 * for use in test code.
 *
 * @author Johannes Henkel
 */
@GwtCompatible
public @interface VisibleForTesting {
}

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message