Add @since tag to classes in unittests package

This commit is contained in:
JeremyStar™ 2024-06-28 01:11:55 +02:00
parent f5075b9832
commit bba645f69b
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
2 changed files with 22 additions and 4 deletions

View file

@ -23,18 +23,23 @@ import de.staropensource.sosengine.base.classes.logging.LogLevel;
/**
* Static configuration for the sos!engine unit testing helpers.
*
* @since 1-alpha0
*/
public class UnitConfig {
/**
* Constructor.
*
* @since 1-alpha0
*/
public UnitConfig() {}
/**
* Configures the {@link LogLevel} for the {@link UnitLogger}.<br/>
* Note: The log level {@code SILENT_WARNING} is used for printing test calls.
* Note: The log level {@code SILENT_WARNING} has been repurposed for printing test calls.
*
* @see de.staropensource.sosengine.base.logging.Logger
* @see UnitLogger
* @since 1-alpha0
*/
public static LogLevel loggerLevel = LogLevel.SILENT_WARNING;
}

View file

@ -27,11 +27,15 @@ import java.util.List;
/**
* Provides a extremely dead simple logging system for unit tests.
*
* @since 1-alpha0
*/
@SuppressWarnings("unused")
public class UnitLogger {
/**
* The parent class.
*
* @since 1-alpha0
*/
private final Class<?> clazz;
@ -39,6 +43,7 @@ public class UnitLogger {
* Constructor.
*
* @param clazz parent class
* @since 1-alpha0
*/
public UnitLogger(Class<?> clazz) {
this.clazz = clazz;
@ -47,8 +52,10 @@ public class UnitLogger {
/**
* Prints a log message.
*
* @param level log level
* @param message log message (and arguments if called with level {@code SILENT_WARNING})
* @param level log level
* @param message log message
* @param additionalStuff additional arguments
* @since 1-alpha0
*/
private void log(@NotNull LogLevel level, @NotNull String message, List<@Nullable Object> additionalStuff) {
String messageSingle = message;
@ -93,6 +100,7 @@ public class UnitLogger {
* Prints a diagnostic message.
*
* @param message diagnostic log message
* @since 1-alpha0
*/
public void diag(@NotNull String message) {
log(LogLevel.DIAGNOSTIC, message, null);
@ -102,6 +110,7 @@ public class UnitLogger {
* Prints a verbose message.
*
* @param message verbose log message
* @since 1-alpha0
*/
public void verb(@NotNull String message) {
log(LogLevel.VERBOSE, message, null);
@ -112,6 +121,7 @@ public class UnitLogger {
*
* @param methodName name of the test method called
* @param methodArgs arguments of the test method called
* @since 1-alpha0
*/
public void testCall(@NotNull String methodName, @Nullable Object ... methodArgs) {
log(LogLevel.SILENT_WARNING, methodName, List.of(methodArgs));
@ -121,6 +131,7 @@ public class UnitLogger {
* Prints a informational message.
*
* @param message informational log message
* @since 1-alpha0
*/
public void info(@NotNull String message) {
log(LogLevel.INFORMATIONAL, message, null);
@ -130,6 +141,7 @@ public class UnitLogger {
* Prints a warning message.
*
* @param message warning log message
* @since 1-alpha0
*/
public void warn(@NotNull String message) {
log(LogLevel.WARNING, message, null);
@ -139,6 +151,7 @@ public class UnitLogger {
* Prints a error message.
*
* @param message error log message
* @since 1-alpha0
*/
public void error(@NotNull String message) {
log(LogLevel.ERROR, message, null);