Package de.qytera.qtaf.testng.context
Interface AssertionContext
- All Known Implementing Classes:
QtafCucumberHooks,QtafTestNGContext
public interface AssertionContext
This interface contains all assertions QTAF supports natively.
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidassertEquals(Object object1, Object object2) Checks if two objects are equal.default voidassertEquals(Object object1, Object object2, String message) Checks if two objects are equal.default voidassertEquals(Object object1, Object object2, String message, boolean continueOnFailure) Checks if two objects are equal.default voidassertEqualsDeep(Map<?, ?> actual, Map<?, ?> expected) Checks if two maps are deeply equal.default voidassertEqualsDeep(Map<?, ?> actual, Map<?, ?> expected, String message) Checks if two maps are deeply equal.default voidassertEqualsDeep(Map<?, ?> object1, Map<?, ?> object2, String message, boolean continueOnFailure) Checks if two objects are equal.default voidassertEqualsDeep(Set<?> actual, Set<?> expected) Checks if two sets are deeply equal.default voidassertEqualsDeep(Set<?> actual, Set<?> expected, String message) Checks if two sets are deeply equal.default voidassertEqualsDeep(Set<?> object1, Set<?> object2, String message, boolean continueOnFailure) Checks if two objects are equal.default voidassertEqualsNoOrder(Object[] object1, Object[] object2) Asserts that two arrays contain the same elements in no particular order.default voidassertEqualsNoOrder(Object[] object1, Object[] object2, String message) Asserts that two arrays contain the same elements in no particular order.default voidassertEqualsNoOrder(Object[] object1, Object[] object2, String message, boolean continueOnFailure) Asserts that two arrays contain the same elements in no particular order.default voidassertFalse(boolean condition, String message) Assert that a condition is false.default voidassertFalse(boolean condition, String message, boolean continueOnFailure) Assert that a condition is false.default voidassertNotEquals(Object object1, Object object2) Checks if two objects are not equal.default voidassertNotEquals(Object object1, Object object2, String message) Checks if two objects are not equal.default voidassertNotEquals(Object object1, Object object2, String message, boolean continueOnFailure) Checks if two objects are not equal.default voidassertNotEqualsDeep(Map<?, ?> actual, Map<?, ?> expected) Checks if two maps are not deeply equal.default voidassertNotEqualsDeep(Map<?, ?> actual, Map<?, ?> expected, String message) Checks if two maps are not deeply equal.default voidassertNotEqualsDeep(Map<?, ?> object1, Map<?, ?> object2, String message, boolean continueOnFailure) Checks if two objects are not deeply equal.default voidassertNotEqualsDeep(Set<?> actual, Set<?> expected) Checks if two sets are not deeply equal.default voidassertNotEqualsDeep(Set<?> actual, Set<?> expected, String message) Checks if two sets are not deeply equal.default voidassertNotEqualsDeep(Set<?> object1, Set<?> object2, String message, boolean continueOnFailure) Checks if two objects are not deeply equal.default voidassertNotNull(Object object) Assert that an object is not null.default voidassertNotNull(Object object, String message) Assert that an object is not null.default voidassertNotNull(Object object, String message, boolean continueOnFailure) Assert that an object is not null.default voidassertNotSame(Object actual, Object expected) Asserts that two objects do not refer to the same objects.default voidassertNotSame(Object actual, Object expected, String message) Asserts that two objects do not refer to the same objects.default voidassertNotSame(Object object, Object expected, String message, boolean continueOnFailure) Assert that two objects do not refer to the same object.default voidassertNull(Object object) Assert that an object is null.default voidassertNull(Object object, String message) Assert that an object is null.default voidassertNull(Object object, String message, boolean continueOnFailure) Assert that an object is null.default voidassertSame(Object actual, Object expected) Asserts that two objects refer to the same object.default voidassertSame(Object actual, Object expected, String message) Asserts that two objects refer to the same object.default voidassertSame(Object object, Object expected, String message, boolean continueOnFailure) Assert that two objects refer to the same object.default voidassertTrue(boolean condition, String message) Assert that a condition is true.default voidassertTrue(boolean condition, String message, boolean continueOnFailure) Assert that a condition is true.default AssertionLogMessagebuildAssertionLogMessage(StepInformationLogMessage stepLog, String message) Create a new assertion log message object.Returns the collection containing all scenario logs.default StringGet a string that will be set as the logging message when no logging message is given by the test case.default voidhandleAssertCondition(AssertionLogMessageType type, boolean condition, String message, AssertionError error) Handle condition assertions.default voidhandleAssertCondition(AssertionLogMessageType type, Object object, Object expected, String message, AssertionError error) Handle condition assertions.default voidhandleAssertCondition(AssertionLogMessageType type, Object object, String message, AssertionError error) Handle condition assertions.default voidhandleAssertEquals(Object object1, Object object2, String message, AssertionError error) Handle assertEquals method call.default voidhandleAssertEqualsDeep(Object object1, Object object2, String message, AssertionError error) Handle assertDeepEquals method call.default voidhandleAssertEqualsNoOrder(Object[] object1, Object[] object2, String message, AssertionError error) Handle assertEqualsNoOrder method call.default voidhandleAssertFalse(boolean condition, String message, AssertionError error) Handle assertFalse method call.default voidhandleAssertNotEquals(Object object1, Object object2, String message, AssertionError error) Handle assertNotEquals method call.default voidhandleAssertNotEqualsDeep(Object object1, Object object2, String message, AssertionError error) Handle assertNotEqualsDeep method call.default voidhandleAssertNotNull(Object object, String message, AssertionError error) Handle assertNull method call.default voidhandleAssertNotSame(Object object, Object expected, String message, AssertionError error) Handle assertNotSame method call.default voidhandleAssertNull(Object object, String message, AssertionError error) Handle assertNull method call.default voidhandleAssertSame(Object object, Object expected, String message, AssertionError error) Handle assertSame method call.default voidhandleAssertTrue(boolean condition, String message, AssertionError error) Handle assertTrue method call.
-
Method Details
-
getLogCollection
TestScenarioLogCollection getLogCollection()Returns the collection containing all scenario logs.- Returns:
- the scenario log collection
-
getNoMessageString
Get a string that will be set as the logging message when no logging message is given by the test case.- Returns:
- default log message
-
assertTrue
Assert that a condition is true.- Parameters:
condition- The conditionmessage- The message that should be displayed if the assertion fails
-
assertTrue
Assert that a condition is true.- Parameters:
condition- The conditionmessage- The message that should be displayed if the assertion failscontinueOnFailure- Should the assertion stop the test case on failure?
-
assertFalse
Assert that a condition is false.- Parameters:
condition- The conditionmessage- The message that should be displayed if the assertion fails
-
assertFalse
Assert that a condition is false.- Parameters:
condition- The conditionmessage- The message that should be displayed if the assertion failscontinueOnFailure- Should the assertion stop the test case on failure?
-
assertNull
Assert that an object is null.- Parameters:
object- The object
-
assertNull
Assert that an object is null.- Parameters:
object- The objectmessage- The message that should be displayed if the assertion fails
-
assertNull
Assert that an object is null.- Parameters:
object- The objectmessage- The message that should be displayed if the assertion failscontinueOnFailure- Should the assertion stop the test case on failure?
-
assertNotNull
Assert that an object is not null.- Parameters:
object- The object
-
assertNotNull
Assert that an object is not null.- Parameters:
object- The objectmessage- The message that should be displayed if the assertion fails
-
assertNotNull
Assert that an object is not null.- Parameters:
object- The objectmessage- The message that should be displayed if the assertion failscontinueOnFailure- Should the assertion stop the test case on failure?
-
assertSame
Asserts that two objects refer to the same object.- Parameters:
actual- Actual objectexpected- Expected object
-
assertSame
Asserts that two objects refer to the same object.- Parameters:
actual- Actual objectexpected- Expected objectmessage- The message that should be displayed if the assertion fails
-
assertSame
Assert that two objects refer to the same object.- Parameters:
object- Actual objectexpected- Expected objectmessage- The message that should be displayed if the assertion failscontinueOnFailure- Should the assertion stop the test case on failure?
-
assertNotSame
Asserts that two objects do not refer to the same objects.- Parameters:
actual- Actual objectexpected- Expected object
-
assertNotSame
Asserts that two objects do not refer to the same objects.- Parameters:
actual- Actual objectexpected- Expected objectmessage- The message that should be displayed if the assertion fails
-
assertNotSame
default void assertNotSame(Object object, Object expected, String message, boolean continueOnFailure) Assert that two objects do not refer to the same object.- Parameters:
object- Actual objectexpected- Expected objectmessage- The message that should be displayed if the assertion failscontinueOnFailure- Should the assertion stop the test case on failure?
-
assertEquals
Checks if two objects are equal.- Parameters:
object1- The first objectobject2- The second object
-
assertEquals
Checks if two objects are equal.- Parameters:
object1- The first objectobject2- The second objectmessage- The message that should be displayed if the assertion fails
-
assertEquals
default void assertEquals(Object object1, Object object2, String message, boolean continueOnFailure) Checks if two objects are equal.- Parameters:
object1- Actual objectobject2- Expected objectmessage- The message that should be displayed if the assertion failscontinueOnFailure- Should the assertion stop the test case on failure?
-
assertEqualsDeep
Checks if two sets are deeply equal.- Parameters:
actual- The first objectexpected- The second object
-
assertEqualsDeep
Checks if two sets are deeply equal.- Parameters:
actual- The first objectexpected- The second objectmessage- The message that should be displayed if the assertion fails
-
assertEqualsDeep
Checks if two maps are deeply equal.- Parameters:
actual- The first objectexpected- The second object
-
assertEqualsDeep
Checks if two maps are deeply equal.- Parameters:
actual- The first objectexpected- The second objectmessage- The message that should be displayed if the assertion fails
-
assertEqualsDeep
default void assertEqualsDeep(Map<?, ?> object1, Map<?, ?> object2, String message, boolean continueOnFailure) Checks if two objects are equal.- Parameters:
object1- Actual objectobject2- Expected objectmessage- The message that should be displayed if the assertion failscontinueOnFailure- Should the assertion stop the test case on failure?
-
assertEqualsDeep
default void assertEqualsDeep(Set<?> object1, Set<?> object2, String message, boolean continueOnFailure) Checks if two objects are equal.- Parameters:
object1- Actual objectobject2- Expected objectmessage- The message that should be displayed if the assertion failscontinueOnFailure- Should the assertion stop the test case on failure?
-
assertNotEqualsDeep
Checks if two sets are not deeply equal.- Parameters:
actual- The first objectexpected- The second object
-
assertNotEqualsDeep
Checks if two sets are not deeply equal.- Parameters:
actual- The first objectexpected- The second objectmessage- The message that should be displayed if the assertion fails
-
assertNotEqualsDeep
Checks if two maps are not deeply equal.- Parameters:
actual- The first objectexpected- The second object
-
assertNotEqualsDeep
Checks if two maps are not deeply equal.- Parameters:
actual- The first objectexpected- The second objectmessage- The message that should be displayed if the assertion fails
-
assertNotEqualsDeep
default void assertNotEqualsDeep(Map<?, ?> object1, Map<?, ?> object2, String message, boolean continueOnFailure) Checks if two objects are not deeply equal.- Parameters:
object1- Actual objectobject2- Expected objectmessage- The message that should be displayed if the assertion failscontinueOnFailure- Should the assertion stop the test case on failure?
-
assertNotEqualsDeep
default void assertNotEqualsDeep(Set<?> object1, Set<?> object2, String message, boolean continueOnFailure) Checks if two objects are not deeply equal.- Parameters:
object1- Actual objectobject2- Expected objectmessage- The message that should be displayed if the assertion failscontinueOnFailure- Should the assertion stop the test case on failure?
-
assertEqualsNoOrder
Asserts that two arrays contain the same elements in no particular order.- Parameters:
object1- The first objectobject2- The second object
-
assertEqualsNoOrder
Asserts that two arrays contain the same elements in no particular order.- Parameters:
object1- The first objectobject2- The second objectmessage- The message that should be displayed if the assertion fails
-
assertEqualsNoOrder
default void assertEqualsNoOrder(Object[] object1, Object[] object2, String message, boolean continueOnFailure) Asserts that two arrays contain the same elements in no particular order.- Parameters:
object1- The first objectobject2- The second objectmessage- The message that should be displayed if the assertion failscontinueOnFailure- Should the assertion stop the test case on failure?
-
assertNotEquals
Checks if two objects are not equal.- Parameters:
object1- The first objectobject2- The second object
-
assertNotEquals
Checks if two objects are not equal.- Parameters:
object1- The first objectobject2- The second objectmessage- The message that should be displayed if the assertion fails
-
assertNotEquals
default void assertNotEquals(Object object1, Object object2, String message, boolean continueOnFailure) Checks if two objects are not equal.- Parameters:
object1- Actual objectobject2- Expected objectmessage- The message that should be displayed if the assertion failscontinueOnFailure- Should the assertion stop the test case on failure?
-
buildAssertionLogMessage
default AssertionLogMessage buildAssertionLogMessage(StepInformationLogMessage stepLog, String message) Create a new assertion log message object.- Parameters:
stepLog- step log that belongs to the assertion logmessage- assertion message- Returns:
- assertion log object
-
handleAssertCondition
default void handleAssertCondition(AssertionLogMessageType type, boolean condition, String message, AssertionError error) Handle condition assertions.- Parameters:
type- assertion typecondition- condition that should be testedmessage- assertion messageerror- assertion error
-
handleAssertCondition
default void handleAssertCondition(AssertionLogMessageType type, Object object, String message, AssertionError error) Handle condition assertions.- Parameters:
type- assertion typeobject- object that should be testedmessage- assertion messageerror- assertion error
-
handleAssertCondition
default void handleAssertCondition(AssertionLogMessageType type, Object object, Object expected, String message, AssertionError error) Handle condition assertions.- Parameters:
type- assertion typeobject- object that should be testedexpected- object that was expectedmessage- assertion messageerror- assertion error
-
handleAssertTrue
Handle assertTrue method call.- Parameters:
condition- condition that should be testedmessage- assertion messageerror- assertion error
-
handleAssertFalse
Handle assertFalse method call.- Parameters:
condition- condition that should be testedmessage- assertion messageerror- assertion error
-
handleAssertNull
Handle assertNull method call.- Parameters:
object- object that should be testedmessage- assertion messageerror- assertion error
-
handleAssertNotNull
Handle assertNull method call.- Parameters:
object- object that should be testedmessage- assertion messageerror- assertion error
-
handleAssertSame
Handle assertSame method call.- Parameters:
object- object that should be testedexpected- object that is expected to be equalmessage- assertion messageerror- assertion error
-
handleAssertNotSame
default void handleAssertNotSame(Object object, Object expected, String message, AssertionError error) Handle assertNotSame method call.- Parameters:
object- object that should be testedexpected- object that is expected to be equalmessage- assertion messageerror- assertion error
-
handleAssertEquals
default void handleAssertEquals(Object object1, Object object2, String message, AssertionError error) Handle assertEquals method call.- Parameters:
object1- object that should be testedobject2- object that is expected to be equalmessage- assertion messageerror- assertion error
-
handleAssertNotEquals
default void handleAssertNotEquals(Object object1, Object object2, String message, AssertionError error) Handle assertNotEquals method call.- Parameters:
object1- object that should be testedobject2- object that is expected to be equalmessage- assertion messageerror- assertion error
-
handleAssertEqualsDeep
default void handleAssertEqualsDeep(Object object1, Object object2, String message, AssertionError error) Handle assertDeepEquals method call.- Parameters:
object1- object that should be testedobject2- object that is expected to be equalmessage- assertion messageerror- assertion error
-
handleAssertNotEqualsDeep
default void handleAssertNotEqualsDeep(Object object1, Object object2, String message, AssertionError error) Handle assertNotEqualsDeep method call.- Parameters:
object1- object that should be testedobject2- object that is expected to be equalmessage- assertion messageerror- assertion error
-
handleAssertEqualsNoOrder
default void handleAssertEqualsNoOrder(Object[] object1, Object[] object2, String message, AssertionError error) Handle assertEqualsNoOrder method call.- Parameters:
object1- object that should be testedobject2- object that is expected to be equalmessage- assertion messageerror- assertion error
-