Package org.assertj.db.util
Class Values
java.lang.Object
org.assertj.db.util.Values
Utility methods related to values.
- Author:
- Régis Pouiller, Otoniel Isidoro
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
Returns if the value is close to theNumber
in parameter with the tolerance in parameter.static boolean
areClose
(Value value, DateTimeValue expected, DateTimeValue tolerance) Returns if the value is close to theDateTimeValue
in parameter with the tolerance in parameter.static boolean
areClose
(Value value, DateTimeValue expected, DateValue tolerance) Returns if the value is close to theDateTimeValue
in parameter with the tolerance in parameter.static boolean
areClose
(Value value, DateTimeValue expected, TimeValue tolerance) Returns if the value is close to theDateTimeValue
in parameter with the tolerance in parameter.static boolean
areClose
(Value value, DateValue expected, DateTimeValue tolerance) Returns if the value is close to theDateValue
in parameter with the tolerance in parameter.static boolean
Returns if the value is close to theDateValue
in parameter with the tolerance in parameter.static boolean
Returns if the value is close to theDateValue
in parameter with the tolerance in parameter.static boolean
Returns if the value is close to theTimeValue
in parameter with the tolerance in parameter.static boolean
Returns if theUUID
value is equal to theString
in parameter.static boolean
Returns if the value is equal to the array ofbyte
in parameter.static boolean
Returns if the value is equal to theBoolean
in parameter.static boolean
Returns if the value is equal to theString
in parameter.static boolean
Returns if the value is equal to theNumber
in parameter.static boolean
Returns if the value is equal to another value in parameter.static boolean
Returns if the value is equal to theString
in parameter.static boolean
Returns if the value is equal to theUUID
in parameter.static boolean
areEqual
(Value value, DateTimeValue expected) Returns if the value is equal to theDateTimeValue
in parameter.static boolean
Returns if the value is equal to theDateValue
in parameter.static boolean
Returns if the value is equal to theTimeValue
in parameter.static int
Returns the result of the comparison between the value and theNumber
in parameter.static Object
getRepresentationFromValueInFrontOfClass
(Value value, Class<?> clazz) Returns a representation of the value (this representation is used for error message).static Object
getRepresentationFromValueInFrontOfExpected
(Value value, Object expected) Returns a representation of the value (this representation is used for error message).static Object[]
getRepresentationsFromValuesInFrontOfExpected
(Value[] values, Object[] expected) Returns a representation of the values (this representation is used for error message).
-
Method Details
-
areEqual
Returns if the value is equal to another value in parameter.- Parameters:
value
- The value.expected
- The other value to compare.- Returns:
true
if the value is equal to the value in parameter,false
otherwise.
-
areEqual
Returns if the value is equal to theBoolean
in parameter.- Parameters:
value
- The value.expected
- TheBoolean
to compare.- Returns:
true
if the value is equal to theBoolean
parameter,false
otherwise.
-
areEqual
Returns if the value is equal to theNumber
in parameter.- Parameters:
value
- The value.expected
- TheNumber
to compare.- Returns:
true
if the value is equal to theNumber
parameter,false
otherwise.
-
areEqual
Returns if the value is equal to the array ofbyte
in parameter.- Parameters:
value
- The value.expected
- The array ofbyte
to compare.- Returns:
true
if the value is equal to the array ofbyte
parameter,false
otherwise.
-
areEqual
Returns if the value is equal to theString
in parameter.- Parameters:
value
- The value.expected
- TheString
to compare.- Returns:
true
if the value is equal to theString
parameter,false
otherwise.- Throws:
NullPointerException
- ifexpected
isnull
.AssertJDBException
- Ifvalue
is aNumber
and it is not possible to compare toexpected
.
-
areEqual
Returns if the value is equal to theString
in parameter.- Parameters:
value
- The value.expected
- TheCharacter
to compare.- Returns:
true
if the value is equal to theCharacter
parameter,false
otherwise.- Throws:
NullPointerException
- ifexpected
isnull
.- Since:
- 1.2.0
-
areEqual
Returns if the value is equal to theUUID
in parameter.- Parameters:
value
- The value.expected
- TheUUID
to compare.- Returns:
true
if the value is equal to theUUID
parameter,false
otherwise.- Since:
- 1.1.0
-
areEqual
Returns if theUUID
value is equal to theString
in parameter.- Parameters:
value
- TheUUID
value.expected
- TheString
to compare.- Returns:
true
if theUUID
value is equal to theString
parameter,false
otherwise.- Throws:
AssertJDBException
- If it is not possible to compareUUID
toexpected
.- Since:
- 1.1.0
-
areEqual
Returns if the value is equal to theDateValue
in parameter. -
areEqual
Returns if the value is equal to theTimeValue
in parameter. -
areEqual
Returns if the value is equal to theDateTimeValue
in parameter.- Parameters:
value
- The value.expected
- TheDateTimeValue
to compare.- Returns:
true
if the value is equal to theDateTimeValue
parameter,false
otherwise.
-
compare
Returns the result of the comparison between the value and theNumber
in parameter.- Parameters:
value
- The value.expected
- TheNumber
to compare.- Returns:
0
if the value is equal to theNumber
parameter,-1
if value is less than theNumber
parameter and1
if value is greater than theNumber
parameter.
-
getRepresentationsFromValuesInFrontOfExpected
public static Object[] getRepresentationsFromValuesInFrontOfExpected(Value[] values, Object[] expected) Returns a representation of the values (this representation is used for error message).- Parameters:
values
- Values in the database.expected
- Expected values for comparison.- Returns:
- A representation of the values.
- Throws:
AssertJDBException
- If the length of the two arrays are different.
-
getRepresentationFromValueInFrontOfExpected
Returns a representation of the value (this representation is used for error message).- Parameters:
value
- Value in the database.expected
- Expected value for comparison.- Returns:
- A representation of the value.
-
getRepresentationFromValueInFrontOfClass
Returns a representation of the value (this representation is used for error message).- Parameters:
value
- Value in the database.clazz
- Class for comparison.- Returns:
- A representation of the value.
-
areClose
Returns if the value is close to theNumber
in parameter with the tolerance in parameter.- Parameters:
value
- The value.expected
- TheNumber
to compare.tolerance
- The tolerance of the closeness.- Returns:
true
if the value is close to theNumber
parameter,false
otherwise.
-
areClose
Returns if the value is close to theDateValue
in parameter with the tolerance in parameter.- Parameters:
value
- The value.expected
- TheDateValue
to compare.tolerance
- The tolerance of the closeness.- Returns:
true
if the value is close to theDateValue
parameter,false
otherwise.
-
areClose
Returns if the value is close to theDateValue
in parameter with the tolerance in parameter.- Parameters:
value
- The value.expected
- TheDateValue
to compare.tolerance
- The tolerance of the closeness.- Returns:
true
if the value is close to theDateValue
parameter,false
otherwise.
-
areClose
Returns if the value is close to theDateValue
in parameter with the tolerance in parameter.- Parameters:
value
- The value.expected
- TheDateValue
to compare.tolerance
- The tolerance of the closeness.- Returns:
true
if the value is close to theDateValue
parameter,false
otherwise.
-
areClose
Returns if the value is close to theTimeValue
in parameter with the tolerance in parameter.- Parameters:
value
- The value.expected
- TheTimeValue
to compare.tolerance
- The tolerance of the closeness.- Returns:
true
if the value is close to theTimeValue
parameter,false
otherwise.
-
areClose
Returns if the value is close to theDateTimeValue
in parameter with the tolerance in parameter.- Parameters:
value
- The value.expected
- TheDateTimeValue
to compare.tolerance
- The tolerance of the closeness.- Returns:
true
if the value is close to theDateTimeValue
parameter,false
otherwise.
-
areClose
Returns if the value is close to theDateTimeValue
in parameter with the tolerance in parameter.- Parameters:
value
- The value.expected
- TheDateTimeValue
to compare.tolerance
- The tolerance of the closeness.- Returns:
true
if the value is close to theDateTimeValue
parameter,false
otherwise.
-
areClose
Returns if the value is close to theDateTimeValue
in parameter with the tolerance in parameter.- Parameters:
value
- The value.expected
- TheDateTimeValue
to compare.tolerance
- The tolerance of the closeness.- Returns:
true
if the value is close to theDateTimeValue
parameter,false
otherwise.
-