Generic functionality, utility classes and test-helper, that have been prooven to be useful in Java
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
galan commons tests.launch

Build Status Maven Central License


Generic functionality, utility classes and test-helper, that can be used to accomplish typical common tasks in a java project.

Integration with Maven

Just add the following dependency (see releases for latest version):




Various Supplier for eg. Long-sequences and random alphanumeric strings.


Logging facades and utilities, based on log4j2-api so they can be used with any logging-framework such as log4j, log4j2, logback, slf4j, etc..

  • Say - Facade to log without the need to declare a logger. Messages paramters can be passed as MDC/ThreadContext json-field (useful for logstash). Take a look at the examples.
  • Slogr - Retrieves the Slf4j Logger without passing the actual calling class, which is a typical copy&paste pitfall. Can be avoided by using Say.

  • CommonProxy - Simple wrapper for a proxy in the format [username[:password]@]host[:port]
  • UrlUtil - Decoding/encoding urls with Charset

  • Flux - A fluent http/rest-client interface for Java

  • MailMessenger - Sending multipart mails using a fluent interface.


  • AbstractTestParent - Resets the ApplicationClock and prints the name of each test-method executed
  • FixedDateSupplier - Sets the ApplicationClock to a fixed time (best used with Instants)
  • SimpleWebserverTestParent - Test containing an lightweight http-server (simpleframework).
  • Tests - Helping methods in tests for eg. loading and comparing test resources, some date assertions, test directory handling.


  • ApplicationClock - Clock that acts as time emitter for an application. Uses a java.time.clock.SystemClock (UTC) by default.
  • Durations - Utility class to handle and calculate human readable time durations, such as "2h 30m"
  • Instants - Fluent simplified time creation and modification.
  • Times - Fluent time comparision
  • Sleeper - Sleeps a duration (long or human readable String - as in Durations) without throwing an InterruptedException


Various common functionality, eg.

  • BOM - Adding and remove BOM (byteordermark) UTF-8 headers
  • Contained - Checks if an element is in an (vararg) array
  • Generics - Helper for generics, eg casting to get rid of unchecked warnings.
  • JvmUtil - Provides access to information about the currently running JVM and some process-control (eg. fluent Termination of JVM, ShutdownHook methods).
  • JmxUtil - Helpermethod to register MBeans
  • Measure - Measures and logs duration of Callable or Runnables, if required only every n-invokations.
  • MessageBox - Draws a nice messagebox to the logged output.
  • Pair - Simplified key/value class
  • Retryable - Runs a Callable or ExceptionalRunnable (Runnable with Exceptions) until it runs without Exception at least for the specified times of retries in a compact fluent manner.