Package io.mats3.test
Class MatsTestHelp
java.lang.Object
io.mats3.test.MatsTestHelp
Microscopic helper methods to create Loggers and Ids typically needed when making Mats tests.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
endpoint()
static String
static String
from()
static String
static org.slf4j.Logger
static String
randomId()
static void
takeNap
(int millis) Sleeps the specified number of milliseconds - can emulate processing time, primarily meant for the concurrency tests.static String
static String
terminator
(String what) static String
traceId()
-
Constructor Details
-
MatsTestHelp
public MatsTestHelp()
-
-
Method Details
-
getClassLogger
public static org.slf4j.Logger getClassLogger()- Returns:
- a SLF4J Logger with the classname of the calling class (using
Thread.currentThread().getStackTrace()
to figure this out).
-
endpoint
- Returns:
- a String
"{CallerClassSimpleName.method}.Endpoint"
.
-
endpoint
- Returns:
- a String
"{CallerClassSimpleName.method}.Endpoint.{what}"
.
-
terminator
- Returns:
- a String
"{CallerClassSimpleName.method}.Terminator"
.
-
terminator
- Returns:
- a String
"{CallerClassSimpleName.method}.Terminator"
.
-
traceId
- Returns:
- a String
"{CallerClassSimpleName.method}.traceId.{randomId}"
- BUT PLEASE NOTE!! ALWAYS use a semantically meaningful, globally unique Id as traceId in production code!
-
from
- Returns:
- a String
"{CallerClassSimpleName.method}"
.
-
from
- Returns:
- a String
"{CallerClassSimpleName.method}.{what}"
.
-
randomId
- Returns:
- a random string of length 8 for testing.
-
takeNap
Sleeps the specified number of milliseconds - can emulate processing time, primarily meant for the concurrency tests.- Parameters:
millis
- the number of millis to sleep- Throws:
AssertionError
- if anInterruptedException
occurs.
-