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 Stringendpoint()static Stringstatic Stringfrom()static Stringstatic org.slf4j.Loggerstatic StringrandomId()static voidtakeNap(int millis) Sleeps the specified number of milliseconds - can emulate processing time, primarily meant for the concurrency tests.static Stringstatic Stringterminator(String what) static StringtraceId()
-
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 anInterruptedExceptionoccurs.
-