public abstract class BaseTest
extends org.assertj.core.api.Assertions
abstract base class for all tests. In most cases it will be convenient to extend this class. abstract to clarify its purpose.
final methods setUp() and tearDown() which call protected
methods doSetUp() and doTearDown() internally. doSetUp() and doTearDown() are left empty here. If some default behaviour is desired
during test setup or teardown these methods should be overridden by the subclass.
public class MyTest extends BaseTest {
@Override
protected void doSetUp() {
super.doSetUp();
// ... my code
}
}
Additional value is provided by isInitialSetup() that may be helpful for specific implementations of
doSetUp() where you want to do some cleanup only once for the test-class rather than for every test method.
Unlike BeforeClass this can be used in non-static method code so you have access to injected
dependencies.| Modifier and Type | Field and Description |
|---|---|
protected static boolean |
INITIALIZED
Indicates if the test class is to be set up for the first time.
|
| Constructor and Description |
|---|
BaseTest() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
doSetUp()
Provides initialization previous to the creation of the text fixture.
|
protected void |
doTearDown()
Provides clean up after tests.
|
protected boolean |
isInitialSetup() |
void |
setUp()
Suggests to use
doSetUp() method before each tests. |
void |
tearDown()
Suggests to use
doTearDown() method before each tests. |
allOf, allOf, anyOf, anyOf, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThatCode, assertThatExceptionOfType, assertThatIllegalArgumentException, assertThatIllegalStateException, assertThatIOException, assertThatNullPointerException, assertThatThrownBy, assertThatThrownBy, atIndex, byLessThan, byLessThan, byLessThan, byLessThan, byLessThan, byLessThan, byLessThan, byLessThan, byLessThan, catchThrowable, catchThrowableOfType, contentOf, contentOf, contentOf, contentOf, contentOf, contentOf, doesNotHave, entry, extractProperty, extractProperty, fail, fail, fail, failBecauseExceptionWasNotThrown, filter, filter, from, in, linesOf, linesOf, linesOf, linesOf, linesOf, linesOf, not, not, notIn, offset, offset, registerCustomDateFormat, registerCustomDateFormat, registerFormatterForType, setAllowComparingPrivateFields, setAllowExtractingPrivateFields, setLenientDateParsing, setMaxElementsForPrinting, setMaxLengthForSingleLineDescription, setRemoveAssertJRelatedElementsFromStackTrace, shouldHaveThrown, tuple, useDefaultDateFormatsOnly, useDefaultRepresentation, useRepresentation, within, within, within, within, within, within, within, within, within, withinPercentage, withinPercentage, withinPercentage, withPrecision, withPrecisionprotected static boolean INITIALIZED
true indicates that the class has already
been set up (e.g., database setup) for the execution of an preceding test method.public final void setUp()
doSetUp() method before each tests.public final void tearDown()
doTearDown() method before each tests.protected boolean isInitialSetup()
true if this JUnit class is invoked for the first time (first test method is called), false
otherwise (if this is a subsequent invocation).protected void doSetUp()
protected void doTearDown()
Copyright © 2014–2019 devon4j-Team. All rights reserved.