#include <KeypleAssert.h>
|
template<typename T > |
Assert & | notNull (const std::shared_ptr< T > obj, const std::string &name) |
|
Assert & | notEmpty (const std::string &obj, const std::string &name) |
|
template<typename T > |
Assert & | notEmpty (const std::vector< T > &obj, const std::string &name) |
|
Assert & | notEmpty (const std::vector< uint8_t > &obj, const std::string &name) |
|
Assert & | isTrue (const bool condition, const std::string &name) |
|
Assert & | greaterOrEqual (const size_t number, const size_t minValue, const std::string &name) |
|
Assert & | isEqual (const size_t number, const size_t value, const std::string &name) |
|
Assert & | isInRange (const size_t number, const size_t minValue, const size_t maxValue, const std::string &name) |
|
Assert & | isHexString (const std::string &hex, const std::string &name) |
|
Exposes useful methods for testing method call parameters and raising a IllegalArgumentException unchecked exception.
- Since
- 2.0.0
Definition at line 35 of file KeypleAssert.h.
◆ getInstance()
Assert & keyple::core::util::Assert::getInstance |
( |
| ) |
|
|
static |
Gets the unique instance.
- Returns
- the instance
Definition at line 36 of file KeypleAssert.cpp.
◆ greaterOrEqual()
Assert & keyple::core::util::Assert::greaterOrEqual |
( |
const size_t |
number, |
|
|
const size_t |
minValue, |
|
|
const std::string & |
name |
|
) |
| |
Assert that an integer is not null and is greater than or equal to minValue.
- Parameters
-
number | the number to check |
minValue | the min accepted value |
name | the object name |
- Returns
- the current instance
- Exceptions
-
IllegalArgumentException | if number is null or has a value less than minValue. |
- Since
- 2.0.0
Definition at line 71 of file KeypleAssert.cpp.
◆ isEqual()
Assert & keyple::core::util::Assert::isEqual |
( |
const size_t |
number, |
|
|
const size_t |
value, |
|
|
const std::string & |
name |
|
) |
| |
Assert that an integer is equal to value.
- Parameters
-
number | the number to check |
value | the expected value |
name | the object name |
- Returns
- the current instance
- Exceptions
-
IllegalArgumentException | if number is null or has a value less than minValue. |
- Since
- 2.0.0
Definition at line 86 of file KeypleAssert.cpp.
◆ isHexString()
Assert & keyple::core::util::Assert::isHexString |
( |
const std::string & |
hex, |
|
|
const std::string & |
name |
|
) |
| |
Assert that a string has a valid hexadecimal format.
- Parameters
-
hex | The string to check. |
name | The object name. |
- Returns
- The current instance.
- Exceptions
-
IllegalArgumentException | If the provided string is null, empty or has not a valid hexadecimal format. |
- Since
- 2.1.0
Definition at line 127 of file KeypleAssert.cpp.
◆ isInRange()
Assert & keyple::core::util::Assert::isInRange |
( |
const size_t |
number, |
|
|
const size_t |
minValue, |
|
|
const size_t |
maxValue, |
|
|
const std::string & |
name |
|
) |
| |
Assert that an integer is not null and is in the range minValue, maxValue.
- Parameters
-
number | the number to check |
minValue | the min accepted value |
maxValue | the max accepted value |
name | the object name |
- Returns
- the current instance
- Exceptions
-
IllegalArgumentException | if number is null or is out of range. |
- Since
- 2.0.0
Definition at line 101 of file KeypleAssert.cpp.
◆ isTrue()
Assert & keyple::core::util::Assert::isTrue |
( |
const bool |
condition, |
|
|
const std::string & |
name |
|
) |
| |
Assert that a condition is true.
- Parameters
-
condition | the condition to check |
name | the object name |
- Returns
- the current instance
- Exceptions
-
IllegalArgumentException | if condition is null or false |
- Since
- 2.0.0
Definition at line 62 of file KeypleAssert.cpp.
◆ notEmpty() [1/3]
Assert & keyple::core::util::Assert::notEmpty |
( |
const std::string & |
obj, |
|
|
const std::string & |
name |
|
) |
| |
Assert that the input string is not null and not empty.
- Parameters
-
obj | the object to check |
name | the object name |
- Returns
- the current instance
- Exceptions
-
IllegalArgumentException | if object is null or empty |
- Since
- 2.0.0
Definition at line 43 of file KeypleAssert.cpp.
◆ notEmpty() [2/3]
template<typename T >
Assert & keyple::core::util::Assert::notEmpty |
( |
const std::vector< T > & |
obj, |
|
|
const std::string & |
name |
|
) |
| |
|
inline |
Assert that a collection of objects is not null and not empty.
- Parameters
-
obj | the object to check |
name | the object name |
- Returns
- the current instance
- Exceptions
-
IllegalArgumentException | if object is null or empty |
- Since
- 2.0.0
Definition at line 84 of file KeypleAssert.h.
◆ notEmpty() [3/3]
Assert & keyple::core::util::Assert::notEmpty |
( |
const std::vector< uint8_t > & |
obj, |
|
|
const std::string & |
name |
|
) |
| |
Assert that a byte array is not null and not empty.
- Parameters
-
obj | the object to check |
name | the object name |
- Returns
- the current instance
- Exceptions
-
IllegalArgumentException | if object is null or empty |
- Since
- 2.0.0
Definition at line 53 of file KeypleAssert.cpp.
◆ notNull()
template<typename T >
Assert & keyple::core::util::Assert::notNull |
( |
const std::shared_ptr< T > |
obj, |
|
|
const std::string & |
name |
|
) |
| |
|
inline |
Assert that the input object is not null.
- Parameters
-
obj | the object to check |
name | the object name |
- Returns
- the current instance
- Exceptions
-
IllegalArgumentException | if object is null |
- Since
- 2.0
Definition at line 54 of file KeypleAssert.h.
The documentation for this class was generated from the following files: