Qore jni Module 2.4.0
Loading...
Searching...
No Matches
org.qore.lang.qunit.Test Class Reference

Base class (wrapping the Qore QUnit::Test class) representing a simple test, implements an implicit main() method and all utility methods for testing. More...

Inheritance diagram for org.qore.lang.qunit.Test:
org.qore.jni.QoreObjectWrapper

Public Member Methods

 Test (String name, String version) throws Throwable
 creates the object and sets the name of the test
void globalSetUp () throws Throwable
 global setup; will be called once before tests are run
void globalTearDown () throws Throwable
 global tear down; will be called once after all tests are run
void setUp () throws Throwable
 Prototype method for setting up test environment. It will be called for each test individually.
void tearDown () throws Throwable
 Prototype method for cleaning up test environemnt. It will be called after each test has executed.
String getEnv (String key, String def) throws Throwable
 facade for the system environment variables
void addTestCase (String name, TestCode call) throws Throwable
 adds a test case to run
void addTestCase (String name, TestCodeArgs call, Object... args) throws Throwable
 adds a test case to run
Object testAssertionValue (String name, Object actual, Object expected) throws Throwable
 Tests a value for equality to an expected value.
Object testAssertionValue (String name, BigDecimal actual, BigDecimal expected, BigDecimal epsilon) throws Throwable
 Tests a value for equality to an expected value of number type.
Object testAssertionValue (String name, BigDecimal actual, BigDecimal expected) throws Throwable
 Tests a value for equality to an expected value of number type.
Object testAssertionValue (String name, float actual, float expected, float epsilon) throws Throwable
 Tests a value for equality to an expected value of float type.
Object testAssertionValue (String name, float actual, float expected) throws Throwable
 Tests a value for equality to an expected value of float type.
void assertRegex (String regex_pattern, String actual, String name) throws Throwable
 Tests that a test value passes a regular expression match.
void assertRegex (String regex_pattern, String actual) throws Throwable
 Tests that a test value passes a regular expression match.
void assertNRegex (String regex_pattern, String actual, String name) throws Throwable
 Tests that a test value does not pass a regular expression match.
void assertNothing (Object actual, String name) throws Throwable
 Tests for no value.
void assertNothing (Object actual) throws Throwable
 Tests for no value.
void assertEqSoft (Object expected, Object actual, String name) throws Throwable
 Tests a value for equality to an expected value with soft comparisons (types may differ).
void assertEqSoft (Object expected, Object actual) throws Throwable
 Tests a value for equality to an expected value with soft comparisons (types may differ).
void assertNeqSoft (Object expected, Object actual, String name) throws Throwable
 Tests a value for inequality to an expected value with soft comparisons (types may differ).
void assertNeqSoft (Object expected, Object actual) throws Throwable
 Tests a value for inequality to an expected value with soft comparisons (types may differ).
void assertEq (Object expected, Object actual, String name) throws Throwable
 Tests a value for equality to an expected value with hard comparisons (types and values must be identical).
void assertEq (Object expected, Object actual) throws Throwable
 Tests a value for equality to an expected value with hard comparisons (types and values must be identical).
void assertNeq (Object expected, Object actual, String name) throws Throwable
 Tests a value for inequality to an expected value with hard comparisons (types and values must be identical).
void assertNeq (Object expected, Object actual) throws Throwable
 Tests a value for inequality to an expected value with hard comparisons (types and values must be identical).
void assertFloatEq (float expected, float actual, float epsilon, String name) throws Throwable
 Tests a float value for equality to an expected value with an allowed error.
void assertFloatEq (float expected, float actual, float epsilon) throws Throwable
 Tests a float value for equality to an expected value with an allowed error.
void assertFloatEq (float expected, float actual) throws Throwable
 Tests a float value for equality to an expected value with an allowed error.
void assertNumberEq (BigDecimal expected, BigDecimal actual, BigDecimal epsilon, String name) throws Throwable
 Tests a number value for equality to an expected value with an allowed error.
void assertNumberEq (BigDecimal expected, BigDecimal actual, BigDecimal epsilon) throws Throwable
 Tests a number value for equality to an expected value with an allowed error.
void assertNumberEq (BigDecimal expected, BigDecimal actual) throws Throwable
 Tests a number value for equality to an expected value with an allowed error.
void assertGtSoft (Object expected, Object actual, String name) throws Throwable
 Tests that a value is greater than an expected value with soft comparisons (types may differ).
void assertGtSoft (Object expected, Object actual) throws Throwable
 Tests that a value is greater than an expected value with soft comparisons (types may differ).
void assertGt (Object expected, Object actual, String name) throws Throwable
 Tests that a value is greater than an expected value with hard comparisons (types may not differ).
void assertGt (Object expected, Object actual) throws Throwable
 Tests that a value is greater than an expected value with hard comparisons (types may not differ).
void assertGeSoft (Object expected, Object actual, String name) throws Throwable
 Tests that a value is greater than or equal to than an expected value with soft comparisons (types may differ).
void assertGeSoft (Object expected, Object actual) throws Throwable
 Tests that a value is greater than or equal to than an expected value with soft comparisons (types may differ).
void assertGe (Object expected, Object actual, String name) throws Throwable
 Tests that a value is greater than or equal to an expected value with hard comparisons (types may not differ).
void assertGe (Object expected, Object actual) throws Throwable
 Tests that a value is greater than or equal to an expected value with hard comparisons (types may not differ).
void assertLtSoft (Object expected, Object actual, String name) throws Throwable
 Tests that a value is less than an expected value with soft comparisons (types may differ).
void assertLtSoft (Object expected, Object actual) throws Throwable
 Tests that a value is less than an expected value with soft comparisons (types may differ).
void assertLt (Object expected, Object actual, String name) throws Throwable
 Tests that a value is less than an expected value with hard comparisons (types may not differ).
void assertLt (Object expected, Object actual) throws Throwable
 Tests that a value is less than an expected value with hard comparisons (types may not differ).
void assertLeSoft (Object expected, Object actual, String name) throws Throwable
 Tests that a value is less than or equal to than an expected value with soft comparisons (types may differ).
void assertLeSoft (Object expected, Object actual) throws Throwable
 Tests that a value is less than or equal to than an expected value with soft comparisons (types may differ).
void assertLe (Object expected, Object actual, String name) throws Throwable
 Tests that a value is less than or equal to an expected value with hard comparisons (types may not differ).
void assertLe (Object expected, Object actual) throws Throwable
 Tests that a value is less than or equal to an expected value with hard comparisons (types may not differ).
void assertTrue (Object actual, String name) throws Throwable
 Tests a boolean value.
void assertTrue (Object actual) throws Throwable
 Tests a boolean value.
void assertFalse (Object actual, String name) throws Throwable
 Tests a boolean value.
void assertFalse (Object actual) throws Throwable
 Tests a boolean value.
void assertThrows (String expectedErr, String expectedDesc, TestCodeArgs theCode, Object[] args, String name) throws Throwable
 Tests that a piece of code throws an exception with given description.
void assertThrows (String expectedErr, String expectedDesc, TestCodeArgs theCode, Object[] args) throws Throwable
 Tests that a piece of code throws an exception with given description.
void assertThrows (String expectedErr, String expectedDesc, TestCodeArgs theCode) throws Throwable
 Tests that a piece of code throws an exception with given description.
void assertThrows (String expectedErr, TestCodeArgs theCode, Object[] args, String name) throws Throwable
 Tests that a piece of code throws an exception with given description.
void assertThrows (String expectedErr, TestCodeArgs theCode, Object[] args) throws Throwable
 Tests that a piece of code throws an exception with given description.
void assertThrows (String expectedErr, String expectedDesc, TestCode theCode, String name) throws Throwable
 Tests that a piece of code throws an exception with given description.
void assertThrows (String expectedErr, String expectedDesc, TestCode theCode) throws Throwable
 Tests that a piece of code throws an exception with given description.
void assertThrows (String expectedErr, TestCode theCode, String name) throws Throwable
 Tests that a piece of code throws an exception with given description.
void assertThrows (String expectedErr, TestCode theCode) throws Throwable
 Tests that a piece of code throws an exception with given description.
void assertSkip (String name) throws Throwable
 Skips assertion on purpose.
void fail (String msg) throws Throwable
 Fails the test unconditionally.
void testNullAssertion (String name, TestConditionArgs condition, Object... args) throws Throwable
 Tests for a single assertion for a call returning no value (for example, to ensure that the call does not throw an exception).
Object testAssertion (String name, TestConditionArgs condition, Object[] args, Object expectedResultValue) throws Throwable
 Tests for a single assertion for a call returning an integer value and returns the value generated.
void testNullAssertion (String name, TestCondition condition) throws Throwable
 Tests for a single assertion for a call returning no value (for example, to ensure that the call does not throw an exception).
Object testAssertion (String name, TestCondition condition, Object expectedResultValue) throws Throwable
 Tests for a single assertion for a call returning an integer value and returns the value generated.
Object testAssertion (String name, TestConditionArgs condition, Object[] args, AbstractTestResult expectedResult) throws Throwable
 Tests for a single assertion and returns the value generated.
Object testAssertion (String name, TestConditionArgs condition, Object[] args) throws Throwable
 Tests for a single assertion and returns the value generated.
Object testAssertion (String name, TestCondition condition, AbstractTestResult expectedResult) throws Throwable
 Tests for a single assertion and returns the value generated.
Object testAssertion (String name, TestCondition condition) throws Throwable
 Tests for a single assertion and returns the value generated.
void testSkip (String reason, Object... args) throws Throwable
 Skips a given test, eg. because it may be missing some dependencies.
void testSkip (String reason) throws Throwable
 Skips a given test, eg. because it may be missing some dependencies.
boolean equals (Object a, Object b) throws Throwable
 Compare two values for equality.
boolean notEquals (Object a, Object b) throws Throwable
 Compare two values for inequality.
boolean regexpMatches (String s, String regexp) throws Throwable
 Compare a string for match against a regexp.
int main () throws Throwable
 Run the whole suite, report results.
Public Member Methods inherited from org.qore.jni.QoreObjectWrapper
 QoreObjectWrapper (QoreObject obj)
 creates the wrapper object with the Qore object
void release ()
 releases the Qore object; do not call any further methods on the object after this call
QoreObject getQoreObject ()
 returns the Qore object
String className ()
 returns the class name for the Qore object
boolean instanceOf (String class_name)
 returns true if the object is an instance of the given class

Static Public Member Methods

static String getAssertionName (String name) throws Throwable
 returns the assertion name for display purposes
static String getAssertionName () throws Throwable
 returns the assertion name for display purposes

Private Member Methods

 Test (QoreObject obj) throws Throwable
 creates the object based on the given Qore object

Additional Inherited Members

Private Attributes inherited from org.qore.jni.QoreObjectWrapper
QoreObject obj
 the wrapper Qore object

Detailed Description

Base class (wrapping the Qore QUnit::Test class) representing a simple test, implements an implicit main() method and all utility methods for testing.

Note
Loads and initializes the Qore library and the jni module in static initialization if necessary
Deprecated
Use dynamic imports instead: import qoremod.QUnit.Test;

Member Function Documentation

◆ addTestCase() [1/2]

void org.qore.lang.qunit.Test.addTestCase ( String name,
TestCode call ) throws Throwable
inline

adds a test case to run

Example:
addTestCase("MyTest", \myTest());
void addTestCase(String name, TestCode call)
adds a test case to run
Definition Test.java:80
Parameters
namethe name of the test case
callthe code to call that executes the test case

◆ addTestCase() [2/2]

void org.qore.lang.qunit.Test.addTestCase ( String name,
TestCodeArgs call,
Object... args ) throws Throwable
inline

adds a test case to run

Example:
addTestCase("MyTest", \myTest());
Parameters
namethe name of the test case
callthe code to call that executes the test case
argsany optional arguments to the test case call

◆ assertEq() [1/2]

void org.qore.lang.qunit.Test.assertEq ( Object expected,
Object actual ) throws Throwable
inline

Tests a value for equality to an expected value with hard comparisons (types and values must be identical).

Example:
assertEq(5, method_that_should_return_five());
void assertEq(Object expected, Object actual, String name)
Tests a value for equality to an expected value with hard comparisons (types and values must be ident...
Definition Test.java:310
Parameters
expectedthe expected value
actualthe value generated by the test

◆ assertEq() [2/2]

void org.qore.lang.qunit.Test.assertEq ( Object expected,
Object actual,
String name ) throws Throwable
inline

Tests a value for equality to an expected value with hard comparisons (types and values must be identical).

Example:
assertEq(5, method_that_should_return_five());
Parameters
expectedthe expected value
actualthe value generated by the test
namethe name or description of the assertion

◆ assertEqSoft() [1/2]

void org.qore.lang.qunit.Test.assertEqSoft ( Object expected,
Object actual ) throws Throwable
inline

Tests a value for equality to an expected value with soft comparisons (types may differ).

Example:
assertEqSoft("5", method_that_should_return_five());
void assertEqSoft(Object expected, Object actual, String name)
Tests a value for equality to an expected value with soft comparisons (types may differ).
Definition Test.java:256
Parameters
expectedthe expected value
actualthe value generated by the test

◆ assertEqSoft() [2/2]

void org.qore.lang.qunit.Test.assertEqSoft ( Object expected,
Object actual,
String name ) throws Throwable
inline

Tests a value for equality to an expected value with soft comparisons (types may differ).

Example:
assertEqSoft("5", method_that_should_return_five());
Parameters
expectedthe expected value
actualthe value generated by the test
namethe name or description of the assertion

◆ assertFalse() [1/2]

void org.qore.lang.qunit.Test.assertFalse ( Object actual) throws Throwable
inline

Tests a boolean value.

Example:
assertFalse(methodThatShouldReturnFalse());
void assertFalse(Object actual, String name)
Tests a boolean value.
Definition Test.java:689
Parameters
actualthe value generated by the test

◆ assertFalse() [2/2]

void org.qore.lang.qunit.Test.assertFalse ( Object actual,
String name ) throws Throwable
inline

Tests a boolean value.

Example:
assertFalse(methodThatShouldReturnFalse());
Parameters
actualthe value generated by the test
namethe name or description of the assertion

◆ assertFloatEq() [1/3]

void org.qore.lang.qunit.Test.assertFloatEq ( float expected,
float actual ) throws Throwable
inline

Tests a float value for equality to an expected value with an allowed error.

Example:
assertFloatEq(2.5, 2.50001);
void assertFloatEq(float expected, float actual, float epsilon, String name)
Tests a float value for equality to an expected value with an allowed error.
Definition Test.java:365
Parameters
expectedthe expected value
actualthe value generated by the test

◆ assertFloatEq() [2/3]

void org.qore.lang.qunit.Test.assertFloatEq ( float expected,
float actual,
float epsilon ) throws Throwable
inline

Tests a float value for equality to an expected value with an allowed error.

Example:
assertFloatEq(2.5, 2.50001, 0.001);
Parameters
expectedthe expected value
actualthe value generated by the test
epsilonthe allowed error

◆ assertFloatEq() [3/3]

void org.qore.lang.qunit.Test.assertFloatEq ( float expected,
float actual,
float epsilon,
String name ) throws Throwable
inline

Tests a float value for equality to an expected value with an allowed error.

Example:
assertFloatEq(2.5, 2.50001, 0.001);
Parameters
expectedthe expected value
actualthe value generated by the test
epsilonthe allowed error
namethe name or description of the assertion

◆ assertGe() [1/2]

void org.qore.lang.qunit.Test.assertGe ( Object expected,
Object actual ) throws Throwable
inline

Tests that a value is greater than or equal to an expected value with hard comparisons (types may not differ).

Example:
assertGe(5, method_that_should_rturn_a_value_greater_than_or_equal_to_five());
void assertGe(Object expected, Object actual, String name)
Tests that a value is greater than or equal to an expected value with hard comparisons (types may not...
Definition Test.java:530
Parameters
expecteda value that should be less than or equal to actual
actualthe value generated by the test

◆ assertGe() [2/2]

void org.qore.lang.qunit.Test.assertGe ( Object expected,
Object actual,
String name ) throws Throwable
inline

Tests that a value is greater than or equal to an expected value with hard comparisons (types may not differ).

Example:
assertGe(5, method_that_should_rturn_a_value_greater_than_or_equal_to_five());
Parameters
expecteda value that should be less than or equal to actual
actualthe value generated by the test
namethe name or description of the assertion

◆ assertGeSoft() [1/2]

void org.qore.lang.qunit.Test.assertGeSoft ( Object expected,
Object actual ) throws Throwable
inline

Tests that a value is greater than or equal to than an expected value with soft comparisons (types may differ).

Example:
assertGeSoft("5", method_that_should_rturn_a_value_greater_than_or_equal_to_five());
void assertGeSoft(Object expected, Object actual, String name)
Tests that a value is greater than or equal to than an expected value with soft comparisons (types ma...
Definition Test.java:503
Parameters
expecteda value that should be less than or equal to actual
actualthe value generated by the test

◆ assertGeSoft() [2/2]

void org.qore.lang.qunit.Test.assertGeSoft ( Object expected,
Object actual,
String name ) throws Throwable
inline

Tests that a value is greater than or equal to than an expected value with soft comparisons (types may differ).

Example:
assertGeSoft("5", method_that_should_rturn_a_value_greater_than_or_equal_to_five());
Parameters
expecteda value that should be less than or equal to actual
actualthe value generated by the test
namethe name or description of the assertion

◆ assertGt() [1/2]

void org.qore.lang.qunit.Test.assertGt ( Object expected,
Object actual ) throws Throwable
inline

Tests that a value is greater than an expected value with hard comparisons (types may not differ).

Example:
assertGt(5, method_that_should_rturn_a_value_greater_than_five());
void assertGt(Object expected, Object actual, String name)
Tests that a value is greater than an expected value with hard comparisons (types may not differ).
Definition Test.java:476
Parameters
expecteda value that should be less than actual
actualthe value generated by the test

◆ assertGt() [2/2]

void org.qore.lang.qunit.Test.assertGt ( Object expected,
Object actual,
String name ) throws Throwable
inline

Tests that a value is greater than an expected value with hard comparisons (types may not differ).

Example:
assertGt(5, method_that_should_rturn_a_value_greater_than_five());
Parameters
expecteda value that should be less than actual
actualthe value generated by the test
namethe name or description of the assertion

◆ assertGtSoft() [1/2]

void org.qore.lang.qunit.Test.assertGtSoft ( Object expected,
Object actual ) throws Throwable
inline

Tests that a value is greater than an expected value with soft comparisons (types may differ).

Example:
assertGtSoft("5", method_that_should_rturn_a_value_greater_than_five());
void assertGtSoft(Object expected, Object actual, String name)
Tests that a value is greater than an expected value with soft comparisons (types may differ).
Definition Test.java:449
Parameters
expecteda value that should be less than actual
actualthe value generated by the test

◆ assertGtSoft() [2/2]

void org.qore.lang.qunit.Test.assertGtSoft ( Object expected,
Object actual,
String name ) throws Throwable
inline

Tests that a value is greater than an expected value with soft comparisons (types may differ).

Example:
assertGtSoft("5", method_that_should_rturn_a_value_greater_than_five());
Parameters
expecteda value that should be less than actual
actualthe value generated by the test
namethe name or description of the assertion

◆ assertLe() [1/2]

void org.qore.lang.qunit.Test.assertLe ( Object expected,
Object actual ) throws Throwable
inline

Tests that a value is less than or equal to an expected value with hard comparisons (types may not differ).

Example:
assertLe(5, method_that_should_rturn_a_value_less_than_or_equal_to_five());
void assertLe(Object expected, Object actual, String name)
Tests that a value is less than or equal to an expected value with hard comparisons (types may not di...
Definition Test.java:638
Parameters
expecteda value that should be greater than or equal to actual
actualthe value generated by the test

◆ assertLe() [2/2]

void org.qore.lang.qunit.Test.assertLe ( Object expected,
Object actual,
String name ) throws Throwable
inline

Tests that a value is less than or equal to an expected value with hard comparisons (types may not differ).

Example:
assertLe(5, method_that_should_rturn_a_value_less_than_or_equal_to_five());
Parameters
expecteda value that should be greater than or equal to actual
actualthe value generated by the test
namethe name or description of the assertion

◆ assertLeSoft() [1/2]

void org.qore.lang.qunit.Test.assertLeSoft ( Object expected,
Object actual ) throws Throwable
inline

Tests that a value is less than or equal to than an expected value with soft comparisons (types may differ).

Example:
assertLeSoft("5", method_that_should_rturn_a_value_less_than_or_equal_to_five());
void assertLeSoft(Object expected, Object actual, String name)
Tests that a value is less than or equal to than an expected value with soft comparisons (types may d...
Definition Test.java:611
Parameters
expecteda value that should be greater than or equal to actual
actualthe value generated by the test

◆ assertLeSoft() [2/2]

void org.qore.lang.qunit.Test.assertLeSoft ( Object expected,
Object actual,
String name ) throws Throwable
inline

Tests that a value is less than or equal to than an expected value with soft comparisons (types may differ).

Example:
assertLeSoft("5", method_that_should_rturn_a_value_less_than_or_equal_to_five());
Parameters
expecteda value that should be greater than or equal to actual
actualthe value generated by the test
namethe name or description of the assertion

◆ assertLt() [1/2]

void org.qore.lang.qunit.Test.assertLt ( Object expected,
Object actual ) throws Throwable
inline

Tests that a value is less than an expected value with hard comparisons (types may not differ).

Example:
assertLt(5, method_that_should_rturn_a_value_less_than_five());
void assertLt(Object expected, Object actual, String name)
Tests that a value is less than an expected value with hard comparisons (types may not differ).
Definition Test.java:584
Parameters
expecteda value that should be greater than actual
actualthe value generated by the test

◆ assertLt() [2/2]

void org.qore.lang.qunit.Test.assertLt ( Object expected,
Object actual,
String name ) throws Throwable
inline

Tests that a value is less than an expected value with hard comparisons (types may not differ).

Example:
assertLt(5, method_that_should_rturn_a_value_less_than_five());
Parameters
expecteda value that should be greater than actual
actualthe value generated by the test
namethe name or description of the assertion

◆ assertLtSoft() [1/2]

void org.qore.lang.qunit.Test.assertLtSoft ( Object expected,
Object actual ) throws Throwable
inline

Tests that a value is less than an expected value with soft comparisons (types may differ).

Example:
assertLtSoft("5", method_that_should_rturn_a_value_less_than_five());
void assertLtSoft(Object expected, Object actual, String name)
Tests that a value is less than an expected value with soft comparisons (types may differ).
Definition Test.java:557
Parameters
expecteda value that should be greater than actual
actualthe value generated by the test

◆ assertLtSoft() [2/2]

void org.qore.lang.qunit.Test.assertLtSoft ( Object expected,
Object actual,
String name ) throws Throwable
inline

Tests that a value is less than an expected value with soft comparisons (types may differ).

Example:
assertLtSoft("5", method_that_should_rturn_a_value_less_than_five());
Parameters
expecteda value that should be greater than actual
actualthe value generated by the test
namethe name or description of the assertion

◆ assertNeq() [1/2]

void org.qore.lang.qunit.Test.assertNeq ( Object expected,
Object actual ) throws Throwable
inline

Tests a value for inequality to an expected value with hard comparisons (types and values must be identical).

Example:
assertNeq(5, method_that_should_return_five());
void assertNeq(Object expected, Object actual, String name)
Tests a value for inequality to an expected value with hard comparisons (types and values must be ide...
Definition Test.java:337
Parameters
expectedthe value that should not be equal to the test value with a hard comparison
actualthe value generated by the test

◆ assertNeq() [2/2]

void org.qore.lang.qunit.Test.assertNeq ( Object expected,
Object actual,
String name ) throws Throwable
inline

Tests a value for inequality to an expected value with hard comparisons (types and values must be identical).

Example:
assertNeq(5, method_that_should_return_five());
Parameters
expectedthe value that should not be equal to the test value with a hard comparison
actualthe value generated by the test
namethe name or description of the assertion

◆ assertNeqSoft() [1/2]

void org.qore.lang.qunit.Test.assertNeqSoft ( Object expected,
Object actual ) throws Throwable
inline

Tests a value for inequality to an expected value with soft comparisons (types may differ).

Example:
assertNeqSoft("5", method_that_should_not_return_five());
void assertNeqSoft(Object expected, Object actual, String name)
Tests a value for inequality to an expected value with soft comparisons (types may differ).
Definition Test.java:283
Parameters
expectedthe value that should not be equal to the test value with a soft comparison
actualthe value generated by the test

◆ assertNeqSoft() [2/2]

void org.qore.lang.qunit.Test.assertNeqSoft ( Object expected,
Object actual,
String name ) throws Throwable
inline

Tests a value for inequality to an expected value with soft comparisons (types may differ).

Example:
assertNeqSoft("5", method_that_should_not_return_five());
Parameters
expectedthe value that should not be equal to the test value with a soft comparison
actualthe value generated by the test
namethe name or description of the assertion

◆ assertNothing() [1/2]

void org.qore.lang.qunit.Test.assertNothing ( Object actual) throws Throwable
inline

Tests for no value.

Example:
assertNothing(method_that_should_not_return_a value());
void assertNothing(Object actual, String name)
Tests for no value.
Definition Test.java:230
Parameters
actualthe value generated by the test

◆ assertNothing() [2/2]

void org.qore.lang.qunit.Test.assertNothing ( Object actual,
String name ) throws Throwable
inline

Tests for no value.

Example:
assertNothing(method_that_should_not_return_a value());
Parameters
actualthe value generated by the test
namethe name or description of the assertion

◆ assertNRegex()

void org.qore.lang.qunit.Test.assertNRegex ( String regex_pattern,
String actual,
String name ) throws Throwable
inline

Tests that a test value does not pass a regular expression match.

Example:
assertNRegex("regex string", string_method());
void assertNRegex(String regex_pattern, String actual, String name)
Tests that a test value does not pass a regular expression match.
Definition Test.java:217
Parameters
regex_patternthe regular expression pattern string that the test value should not match
actualthe value generated by the test
namethe name or description of the assertion

◆ assertNumberEq() [1/3]

void org.qore.lang.qunit.Test.assertNumberEq ( BigDecimal expected,
BigDecimal actual ) throws Throwable
inline

Tests a number value for equality to an expected value with an allowed error.

Example:
assertNumberEq(2.5n, 2.50001n);
void assertNumberEq(BigDecimal expected, BigDecimal actual, BigDecimal epsilon, String name)
Tests a number value for equality to an expected value with an allowed error.
Definition Test.java:407
Parameters
expectedthe expected value
actualthe value generated by the test

◆ assertNumberEq() [2/3]

void org.qore.lang.qunit.Test.assertNumberEq ( BigDecimal expected,
BigDecimal actual,
BigDecimal epsilon ) throws Throwable
inline

Tests a number value for equality to an expected value with an allowed error.

Example:
assertNumberEq(2.5n, 2.50001n, 0.001n);
Parameters
expectedthe expected value
actualthe value generated by the test
epsilonthe allowed error
namethe name or description of the assertion

◆ assertNumberEq() [3/3]

void org.qore.lang.qunit.Test.assertNumberEq ( BigDecimal expected,
BigDecimal actual,
BigDecimal epsilon,
String name ) throws Throwable
inline

Tests a number value for equality to an expected value with an allowed error.

Example:
assertNumberEq(2.5n, 2.50001n, 0.001n);
Parameters
expectedthe expected value
actualthe value generated by the test
epsilonthe allowed error
namethe name or description of the assertion

◆ assertRegex() [1/2]

void org.qore.lang.qunit.Test.assertRegex ( String regex_pattern,
String actual ) throws Throwable
inline

Tests that a test value passes a regular expression match.

Example:
assertRegex("regex string", string_method());
void assertRegex(String regex_pattern, String actual, String name)
Tests that a test value passes a regular expression match.
Definition Test.java:189
Parameters
regex_patternthe regular expression pattern string that the test value should match
actualthe value generated by the test
namethe name or description of the assertion

◆ assertRegex() [2/2]

void org.qore.lang.qunit.Test.assertRegex ( String regex_pattern,
String actual,
String name ) throws Throwable
inline

Tests that a test value passes a regular expression match.

Example:
assertRegex("regex string", string_method());
Parameters
regex_patternthe regular expression pattern string that the test value should match
actualthe value generated by the test
namethe name or description of the assertion

◆ assertSkip()

void org.qore.lang.qunit.Test.assertSkip ( String name) throws Throwable
inline

Skips assertion on purpose.

Parameters
namethe name or description of the assertion
Example:
assertSkip("assertion name or reason to skip");
void assertSkip(String name)
Skips assertion on purpose.
Definition Test.java:844

◆ assertThrows() [1/9]

void org.qore.lang.qunit.Test.assertThrows ( String expectedErr,
String expectedDesc,
TestCode theCode ) throws Throwable
inline

Tests that a piece of code throws an exception with given description.

Example:
assertThrows("DIVISION-BY-ZERO", "division by zero found in integer expression", sub(int a) {print(5/a);}, 0);
void assertThrows(String expectedErr, String expectedDesc, TestCodeArgs theCode, Object[] args, String name)
Tests that a piece of code throws an exception with given description.
Definition Test.java:717
Parameters
expectedErrthe expected exception type
expectedDescthe expected exception detail (desc field), ignored if NOTHING
theCodethe code to execute

◆ assertThrows() [2/9]

void org.qore.lang.qunit.Test.assertThrows ( String expectedErr,
String expectedDesc,
TestCode theCode,
String name ) throws Throwable
inline

Tests that a piece of code throws an exception with given description.

Example:
assertThrows("DIVISION-BY-ZERO", "division by zero found in integer expression", sub(int a) {print(5/a);}, 0);
Parameters
expectedErrthe expected exception type
expectedDescthe expected exception detail (desc field), ignored if NOTHING
theCodethe code to execute
namean optional label for the assertion

◆ assertThrows() [3/9]

void org.qore.lang.qunit.Test.assertThrows ( String expectedErr,
String expectedDesc,
TestCodeArgs theCode ) throws Throwable
inline

Tests that a piece of code throws an exception with given description.

Example:
assertThrows("DIVISION-BY-ZERO", "division by zero found in integer expression", sub(int a) {print(5/a);}, 0);
Parameters
expectedErrthe expected exception type
expectedDescthe expected exception detail (desc field), ignored if NOTHING
theCodethe code to execute

◆ assertThrows() [4/9]

void org.qore.lang.qunit.Test.assertThrows ( String expectedErr,
String expectedDesc,
TestCodeArgs theCode,
Object[] args ) throws Throwable
inline

Tests that a piece of code throws an exception with given description.

Example:
assertThrows("DIVISION-BY-ZERO", "division by zero found in integer expression", sub(int a) {print(5/a);}, 0);
Parameters
expectedErrthe expected exception type
expectedDescthe expected exception detail (desc field), ignored if NOTHING
theCodethe code to execute
argsoptional arguments to the code

◆ assertThrows() [5/9]

void org.qore.lang.qunit.Test.assertThrows ( String expectedErr,
String expectedDesc,
TestCodeArgs theCode,
Object[] args,
String name ) throws Throwable
inline

Tests that a piece of code throws an exception with given description.

Example:
assertThrows("DIVISION-BY-ZERO", "division by zero found in integer expression", sub(int a) {print(5/a);}, 0);
Parameters
expectedErrthe expected exception type
expectedDescthe expected exception detail (desc field), ignored if NOTHING
theCodethe code to execute
argsoptional arguments to the code
namean optional label for the assertion

◆ assertThrows() [6/9]

void org.qore.lang.qunit.Test.assertThrows ( String expectedErr,
TestCode theCode ) throws Throwable
inline

Tests that a piece of code throws an exception with given description.

Example:
assertThrows("DIVISION-BY-ZERO", "division by zero found in integer expression", sub(int a) {print(5/a);}, 0);
Parameters
expectedErrthe expected exception type
theCodethe code to execute

◆ assertThrows() [7/9]

void org.qore.lang.qunit.Test.assertThrows ( String expectedErr,
TestCode theCode,
String name ) throws Throwable
inline

Tests that a piece of code throws an exception with given description.

Example:
assertThrows("DIVISION-BY-ZERO", "division by zero found in integer expression", sub(int a) {print(5/a);}, 0);
Parameters
expectedErrthe expected exception type
theCodethe code to execute
namean optional label for the assertion

◆ assertThrows() [8/9]

void org.qore.lang.qunit.Test.assertThrows ( String expectedErr,
TestCodeArgs theCode,
Object[] args ) throws Throwable
inline

Tests that a piece of code throws an exception with given description.

Example:
assertThrows("DIVISION-BY-ZERO", "division by zero found in integer expression", sub(int a) {print(5/a);}, 0);
Parameters
expectedErrthe expected exception type
theCodethe code to execute
argsoptional arguments to the code

◆ assertThrows() [9/9]

void org.qore.lang.qunit.Test.assertThrows ( String expectedErr,
TestCodeArgs theCode,
Object[] args,
String name ) throws Throwable
inline

Tests that a piece of code throws an exception with given description.

Example:
assertThrows("DIVISION-BY-ZERO", "division by zero found in integer expression", sub(int a) {print(5/a);}, 0);
Parameters
expectedErrthe expected exception type
theCodethe code to execute
argsoptional arguments to the code
namean optional label for the assertion

◆ assertTrue() [1/2]

void org.qore.lang.qunit.Test.assertTrue ( Object actual) throws Throwable
inline

Tests a boolean value.

Example:
assertTrue(methodThatShouldReturnTrue());
void assertTrue(Object actual, String name)
Tests a boolean value.
Definition Test.java:664
Parameters
actualthe value generated by the test

◆ assertTrue() [2/2]

void org.qore.lang.qunit.Test.assertTrue ( Object actual,
String name ) throws Throwable
inline

Tests a boolean value.

Example:
assertTrue(methodThatShouldReturnTrue());
Parameters
actualthe value generated by the test
namethe name or description of the assertion

◆ equals()

boolean org.qore.lang.qunit.Test.equals ( Object a,
Object b ) throws Throwable
inline

Compare two values for equality.

Parameters
aArgument 1
bArgument 2
Returns
a == b

◆ fail()

void org.qore.lang.qunit.Test.fail ( String msg) throws Throwable
inline

Fails the test unconditionally.

Example:
fail("Unexpected code executed");
void fail(String msg)
Fails the test unconditionally.
Definition Test.java:856
Parameters
msgthe failure message

◆ notEquals()

boolean org.qore.lang.qunit.Test.notEquals ( Object a,
Object b ) throws Throwable
inline

Compare two values for inequality.

Parameters
aArgument 1
bArgument 2
Returns
a != b

◆ regexpMatches()

boolean org.qore.lang.qunit.Test.regexpMatches ( String s,
String regexp ) throws Throwable
inline

Compare a string for match against a regexp.

Parameters
sString to match
regexpRegular expression to match against
Returns
a == b

◆ testAssertion() [1/6]

Object org.qore.lang.qunit.Test.testAssertion ( String name,
TestCondition condition ) throws Throwable
inline

Tests for a single assertion and returns the value generated.

Parameters
namethe name or description of the assertion
conditionA test function whose result we are asserting
Returns
the result of the condition call, if the immediate value has any further use

◆ testAssertion() [2/6]

Object org.qore.lang.qunit.Test.testAssertion ( String name,
TestCondition condition,
AbstractTestResult expectedResult ) throws Throwable
inline

Tests for a single assertion and returns the value generated.

Parameters
namethe name or description of the assertion
conditionA test function whose result we are asserting
expectedResultA class describing the expected result of condition; the default is QUnit::TestResultSuccess
Returns
the result of the condition call, if the immediate value has any further use

◆ testAssertion() [3/6]

Object org.qore.lang.qunit.Test.testAssertion ( String name,
TestCondition condition,
Object expectedResultValue ) throws Throwable
inline

Tests for a single assertion for a call returning an integer value and returns the value generated.

Parameters
namethe name or description of the assertion
conditionA test function whose result we are asserting
expectedResultValuethe expected value
Returns
the result of the condition call, if the immediate value has any further use

◆ testAssertion() [4/6]

Object org.qore.lang.qunit.Test.testAssertion ( String name,
TestConditionArgs condition,
Object[] args ) throws Throwable
inline

Tests for a single assertion and returns the value generated.

Parameters
namethe name or description of the assertion
conditionA test function whose result we are asserting
argsArguments passed to condition
Returns
the result of the condition call, if the immediate value has any further use

◆ testAssertion() [5/6]

Object org.qore.lang.qunit.Test.testAssertion ( String name,
TestConditionArgs condition,
Object[] args,
AbstractTestResult expectedResult ) throws Throwable
inline

Tests for a single assertion and returns the value generated.

Parameters
namethe name or description of the assertion
conditionA test function whose result we are asserting
argsArguments passed to condition
expectedResultA class describing the expected result of condition; the default is QUnit::TestResultSuccess
Returns
the result of the condition call, if the immediate value has any further use

◆ testAssertion() [6/6]

Object org.qore.lang.qunit.Test.testAssertion ( String name,
TestConditionArgs condition,
Object[] args,
Object expectedResultValue ) throws Throwable
inline

Tests for a single assertion for a call returning an integer value and returns the value generated.

Parameters
namethe name or description of the assertion
conditionA test function whose result we are asserting
argsArguments passed to condition
expectedResultValuethe expected value
Returns
the result of the condition call, if the immediate value has any further use

◆ testAssertionValue() [1/5]

Object org.qore.lang.qunit.Test.testAssertionValue ( String name,
BigDecimal actual,
BigDecimal expected ) throws Throwable
inline

Tests a value for equality to an expected value of number type.

Parameters
namethe name or description of the assertion
actualthe value generated by the test
expectedthe expected value
Returns
the actual argument
Note
make sure and use testAssertion() for any calls that could throw an exception

◆ testAssertionValue() [2/5]

Object org.qore.lang.qunit.Test.testAssertionValue ( String name,
BigDecimal actual,
BigDecimal expected,
BigDecimal epsilon ) throws Throwable
inline

Tests a value for equality to an expected value of number type.

Parameters
namethe name or description of the assertion
actualthe value generated by the test
expectedthe expected value
epsilonaccepted difference
Returns
the actual argument
Note
make sure and use testAssertion() for any calls that could throw an exception

◆ testAssertionValue() [3/5]

Object org.qore.lang.qunit.Test.testAssertionValue ( String name,
float actual,
float expected ) throws Throwable
inline

Tests a value for equality to an expected value of float type.

Parameters
namethe name or description of the assertion
actualthe value generated by the test
expectedthe expected value
epsilonaccepted difference
Returns
the actual argument
Note
make sure and use testAssertion() for any calls that could throw an exception

◆ testAssertionValue() [4/5]

Object org.qore.lang.qunit.Test.testAssertionValue ( String name,
float actual,
float expected,
float epsilon ) throws Throwable
inline

Tests a value for equality to an expected value of float type.

Parameters
namethe name or description of the assertion
actualthe value generated by the test
expectedthe expected value
epsilonaccepted difference
Returns
the actual argument
Note
make sure and use testAssertion() for any calls that could throw an exception

◆ testAssertionValue() [5/5]

Object org.qore.lang.qunit.Test.testAssertionValue ( String name,
Object actual,
Object expected ) throws Throwable
inline

Tests a value for equality to an expected value.

Example:
testAssertionValue("date > operator", now() > (now() - 1D), True);
Object testAssertionValue(String name, Object actual, Object expected)
Tests a value for equality to an expected value.
Definition Test.java:112
Parameters
namethe name or description of the assertion
actualthe value generated by the test
expectedthe expected value
Returns
the value argument
Note
make sure and use testAssertion() for any calls that could throw an exception

◆ testNullAssertion() [1/2]

void org.qore.lang.qunit.Test.testNullAssertion ( String name,
TestCondition condition ) throws Throwable
inline

Tests for a single assertion for a call returning no value (for example, to ensure that the call does not throw an exception).

Parameters
namethe name or description of the assertion
conditionA test function whose result we are asserting
Returns
the result of the condition call, if the immediate value has any further use

◆ testNullAssertion() [2/2]

void org.qore.lang.qunit.Test.testNullAssertion ( String name,
TestConditionArgs condition,
Object... args ) throws Throwable
inline

Tests for a single assertion for a call returning no value (for example, to ensure that the call does not throw an exception).

Parameters
namethe name or description of the assertion
conditionA test function whose result we are asserting
argsArguments passed to condition
Returns
the result of the condition call, if the immediate value has any further use

◆ testSkip() [1/2]

void org.qore.lang.qunit.Test.testSkip ( String reason) throws Throwable
inline

Skips a given test, eg. because it may be missing some dependencies.

Parameters
reasonThe reason for the test skip

◆ testSkip() [2/2]

void org.qore.lang.qunit.Test.testSkip ( String reason,
Object... args ) throws Throwable
inline

Skips a given test, eg. because it may be missing some dependencies.

Parameters
reasonThe reason for the test skip; used as the format argument with vsprintf() with any remaining arguments

The documentation for this class was generated from the following file:
  • src/java/org/qore/lang/qunit/Test.java