Class BaseTest
- java.lang.Object
-
- org.assertj.core.api.Assertions
-
- com.devonfw.module.test.common.base.BaseTest
-
- Direct Known Subclasses:
ComponentTest,ModuleTest,SubsystemTest,SystemTest
public abstract class BaseTest extends org.assertj.core.api.AssertionsThis is theabstractbase class for all tests. In most cases it will be convenient to extend this class.
Although it does not contain abstract methods, the class itself is declaredabstractto clarify its purpose.
This class providesfinalmethodssetUp()andtearDown()which callprotectedmethodsdoSetUp()anddoTearDown()internally.
Both methodsdoSetUp()anddoTearDown()are left empty here. If some default behaviour is desired during test setup or teardown these methods should be overridden by the subclass.
Implementations must call the super implementation. This call should always happen at the beginning of the implementation. This helps to avoid confusion of call orders.
The following listing should clarify the intention:public class MyTest extends BaseTest { @Override protected void doSetUp() { super.doSetUp(); // ... my code } }Additional value is provided byisInitialSetup()that may be helpful for specific implementations ofdoSetUp()where you want to do some cleanup only once for the test-class rather than for every test method. UnlikeBeforeClassthis can be used in non-static method code so you have access to injected dependencies.- Author:
- shuber, jmolinar
-
-
Field Summary
Fields Modifier and Type Field Description protected static booleanINITIALIZEDIndicates if the test class is to be set up for the first time.
-
Constructor Summary
Constructors Constructor Description BaseTest()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddoSetUp()Provides initialization previous to the creation of the text fixture.protected voiddoTearDown()Provides clean up after tests.protected booleanisInitialSetup()voidsetUp()Suggests to usedoSetUp()method before each tests.voidtearDown()Suggests to usedoTearDown()method before each tests.-
Methods inherited from class org.assertj.core.api.Assertions
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, withPrecision
-
-
-
-
Method Detail
-
setUp
@BeforeEach public final void setUp()
Suggests to usedoSetUp()method before each tests.
-
tearDown
@AfterEach public final void tearDown()
Suggests to usedoTearDown()method before each tests.
-
isInitialSetup
protected boolean isInitialSetup()
- Returns:
trueif this JUnit class is invoked for the first time (first test method is called),falseotherwise (if this is a subsequent invocation).
-
doSetUp
protected void doSetUp()
Provides initialization previous to the creation of the text fixture.
-
doTearDown
protected void doTearDown()
Provides clean up after tests.
-
-