Class SoftAssertions
java.lang.Object
com.qaitsolutions.pframe.core.assertion.SoftAssertions
SoftAssertion implementation over
Truth
.
- Since:
- 1.0
- Author:
- Iulian Andrei (iulian.andrei@qaitsolutions.com)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Fails when previous asserts fail and failures are registered in the tracker.assertThat
(Boolean actual) Wrapper overTruth.assertThat(Boolean)
.assertThat
(Double actual) Wrapper overTruth.assertThat(Double)
.assertThat
(Float actual) Wrapper overTruth.assertThat(Float)
.assertThat
(Integer actual) Wrapper overTruth.assertThat(Integer)
.assertThat
(Iterable<?> actual) Wrapper overTruth.assertThat(Iterable)
.assertThat
(Long actual) Wrapper overTruth.assertThat(Long)
.assertThat
(Object actual) Wrapper overTruth.assertThat(Object)
.assertThat
(String actual) Wrapper overTruth.assertThat(String)
.assertThat
(BigDecimal actual) Wrapper overTruth.assertThat(BigDecimal)
.assertThat
(Map<?, ?> actual) Wrapper overTruth.assertThat(Map)
.<T extends Comparable<?>>
ComparableSubject<T> assertThat
(T actual) Wrapper overTruth.assertThat(Comparable)
.assertWithMessage
(String message) Wrapper overTruth.assertWithMessage(String)
.assertWithMessage
(String format, Object... args) Wrapper overTruth.assertWithMessage(String, Object...)
.void
hardFail()
Will fail (error) when used.void
softFail()
Will add a fail (error) in the error list but will not fail untilassertAll()
method is used.
-
Constructor Details
-
SoftAssertions
public SoftAssertions()
-
-
Method Details
-
assertAll
public void assertAll()Fails when previous asserts fail and failures are registered in the tracker. After fail, the tracker is emptied so that it can be used again.- Throws:
AssertionError
- If any error has been registered to the point of using this method.
-
assertThat
Wrapper overTruth.assertThat(Integer)
.- Parameters:
actual
- CurrentInteger
value to be verified.- Returns:
IntegerSubject
with integer specific assertions methods.
-
assertThat
Wrapper overTruth.assertThat(Iterable)
.- Parameters:
actual
- CurrentIterable
value to be verified.- Returns:
IterableSubject
with specific assertions methods.
-
assertThat
Wrapper overTruth.assertThat(Boolean)
.- Parameters:
actual
- CurrentBoolean
value to be verified.- Returns:
BooleanSubject
with specific assertions methods.
-
assertThat
Wrapper overTruth.assertThat(Double)
.- Parameters:
actual
- CurrentDouble
value to be verified.- Returns:
DoubleSubject
with specific assertions methods.
-
assertThat
Wrapper overTruth.assertThat(Float)
.- Parameters:
actual
- CurrentFloat
value to be verified.- Returns:
DoubleSubject
with specific assertions methods.
-
assertThat
Wrapper overTruth.assertThat(Long)
.- Parameters:
actual
- CurrentLong
value to be verified.- Returns:
LongSubject
with specific assertions methods.
-
assertThat
Wrapper overTruth.assertThat(String)
.- Parameters:
actual
- CurrentString
value to be verified.- Returns:
StringSubject
with specific assertions methods.
-
assertThat
Wrapper overTruth.assertThat(Comparable)
.- Parameters:
actual
- CurrentComparable
value to be verified.- Returns:
ComparableSubject
with specific assertions methods.
-
assertThat
Wrapper overTruth.assertThat(Object)
. -
assertThat
Wrapper overTruth.assertThat(Map)
.- Parameters:
actual
- CurrentMap
value to be verified.- Returns:
MapSubject
with specific assertions methods.
-
assertThat
Wrapper overTruth.assertThat(BigDecimal)
.- Parameters:
actual
- CurrentBigDecimal
value to be verified.- Returns:
BigDecimalSubject
with specific assertions methods.
-
assertWithMessage
Wrapper overTruth.assertWithMessage(String)
.- Parameters:
message
- Text that will be added to the log/report.- Returns:
- A self reference..
-
assertWithMessage
Wrapper overTruth.assertWithMessage(String, Object...)
.- Parameters:
format
- Text that will be added to the log/report inString.format(String, Object...)
.args
- Arguments referenced by the format specifiers in the format string.- Returns:
- A self reference.
-
softFail
public void softFail()Will add a fail (error) in the error list but will not fail untilassertAll()
method is used. Wrapper overStandardSubjectBuilder.fail()
. -
hardFail
public void hardFail()Will fail (error) when used. Wrapper overStandardSubjectBuilder.fail()
.- Throws:
AssertionError
- When method is used it will throw Error.
-