All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.softicar.platform.common.testing.AbstractTest Maven / Gradle / Ivy

Go to download

The SoftiCAR Platform is a lightweight, Java-based library to create interactive business web applications.

There is a newer version: 50.0.0
Show newest version
package com.softicar.platform.common.testing;

import com.softicar.platform.common.core.clock.CurrentClock;
import com.softicar.platform.common.core.clock.TestClock;
import com.softicar.platform.common.core.interfaces.ITestMarker;
import com.softicar.platform.common.core.thread.sleeper.CurrentSleeper;
import com.softicar.platform.common.core.thread.sleeper.TestSleeper;
import com.softicar.platform.common.date.ISOCalendar;
import org.junit.Rule;

/**
 * Recommended base class for all unit tests.
 * 

* This class employs the {@link SingletonTestWatcher} as Junit {@link Rule}. * * @author Oliver Richers */ public abstract class AbstractTest extends Asserts { @Rule public SingletonTestWatcher SingletonTestWatcher = new SingletonTestWatcher(); protected final TestClock testClock; public AbstractTest() { this.testClock = new TestClock(); CurrentClock.set(testClock); ISOCalendar.setDefaultTimeZone(); } /** * Creates a new {@link ITestMarker} instance that can be used as test * marker. * * @return a new instance of {@link ITestMarker} (never null) */ public static ITestMarker newMarker() { return new ITestMarker() { /* nothing to add */ }; } /** * Creates a new {@link TestSleeper} and sets it as the * {@link CurrentSleeper}. * * @return the {@link TestSleeper} (never null) */ protected TestSleeper setupTestSleeper() { TestSleeper sleeper = new TestSleeper(testClock); CurrentSleeper.set(sleeper); return sleeper; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy