public abstract class GenericTestUtils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
GenericTestUtils.DelayAnswer
Mockito answer helper that triggers one latch as soon as the
method is called, then waits on another before continuing.
|
static class |
GenericTestUtils.DelegateAnswer
An Answer implementation that simply forwards all calls through
to a delegate.
|
static class |
GenericTestUtils.SleepAnswer
An Answer implementation which sleeps for a random number of milliseconds
between 0 and a configurable value before delegating to the real
implementation of the method.
|
Modifier and Type | Field and Description |
---|---|
private static AtomicInteger |
sequence |
Constructor and Description |
---|
GenericTestUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
assertExists(File f)
Assert that a given file exists.
|
static void |
assertGlobEquals(File dir,
String pattern,
String... expectedMatches)
List all of the files in 'dir' that match the regex 'pattern'.
|
static void |
assertMatches(String output,
String pattern) |
static void |
assertNoThreadsMatching(String regex)
Assert that there are no threads running whose name matches the
given regular expression.
|
static void |
assertValueNear(long expected,
long actual,
long allowedError) |
static void |
assertValueWithinRange(long expectedMin,
long expectedMax,
long actual) |
static String |
getMethodName()
Extracts the name of the method where the invocation has happened
|
static int |
uniqueSequenceId()
Generates a process-wide unique sequence number.
|
static void |
waitFor(org.apache.hbase.thirdparty.com.google.common.base.Supplier<Boolean> check,
int checkEveryMillis,
int waitForMillis) |
private static final AtomicInteger sequence
public GenericTestUtils()
public static String getMethodName()
public static int uniqueSequenceId()
public static void assertExists(File f)
public static void assertGlobEquals(File dir, String pattern, String... expectedMatches) throws IOException
IOException
- if the dir is inaccessiblepublic static void waitFor(org.apache.hbase.thirdparty.com.google.common.base.Supplier<Boolean> check, int checkEveryMillis, int waitForMillis) throws TimeoutException, InterruptedException
TimeoutException
InterruptedException
public static void assertMatches(String output, String pattern)
public static void assertValueNear(long expected, long actual, long allowedError)
public static void assertValueWithinRange(long expectedMin, long expectedMax, long actual)
public static void assertNoThreadsMatching(String regex)
regex
- the regex to match againstCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.