public class Double2DArrayAssert extends Abstract2DArrayAssert<Double2DArrayAssert,double[][],Double>
doubles.
To create an instance of this class, invoke .
Assertions.assertThat(double[][])
| Modifier and Type | Field and Description |
|---|---|
protected Double2DArrays |
double2dArrays |
actual, info, myself, objects, throwUnsupportedExceptionOnEquals| Constructor and Description |
|---|
Double2DArrayAssert(double[][] actual) |
| Modifier and Type | Method and Description |
|---|---|
Double2DArrayAssert |
contains(double[] value,
Index index)
Verifies that the actual
double[][] contains the given double[] at the given index. |
Double2DArrayAssert |
doesNotContain(double[] value,
Index index)
Verifies that the actual
double[][] does not contain the given double[] at the given index. |
Double2DArrayAssert |
hasDimensions(int expectedFirstDimension,
int expectedSecondDimension)
Verifies that the actual
double[][] has the given dimensions. |
Double2DArrayAssert |
hasNumberOfRows(int expected)
Verifies that the actual two-dimensional array has the given number of rows.
|
Double2DArrayAssert |
hasSameDimensionsAs(Object array)
Verifies that the actual
double[][] has the same dimensions as the given array. |
Double2DArrayAssert |
isDeepEqualTo(double[][] expected)
Verifies that the actual
double[][] is deeply equal to the given one. |
void |
isEmpty()
Verifies that the actual
double[][] is empty, empty means the array has no elements,
said otherwise it can have any number of rows but all rows must be empty. |
Double2DArrayAssert |
isEqualTo(Object expected)
Verifies that the actual
double[][] is equal to the given one. |
Double2DArrayAssert |
isNotEmpty()
Verifies that the actual
double[][] is not empty, not empty means the array has at least one element. |
void |
isNullOrEmpty()
Verifies that the actual
double[][] is null or empty, empty means the array has no elements,
said otherwise it can have any number of rows but all rows must be empty. |
areEqual, asInstanceOf, asList, assertionError, asString, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, doesNotHaveSameHashCodeAs, doesNotHaveToString, equals, extracting, extracting, failure, failureWithActualExpected, failWithActualExpectedAndMessage, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, hasSameHashCodeAs, hasToString, inBinary, inHexadecimal, is, isElementOfCustomAssert, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isInstanceOfSatisfying, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, matches, matches, newListAssertInstance, overridingErrorMessage, overridingErrorMessage, satisfies, satisfies, satisfies, satisfiesAnyOf, satisfiesAnyOf, satisfiesAnyOfForProxy, satisfiesForProxy, setCustomRepresentation, setDescriptionConsumer, setPrintAssertionsDescription, throwAssertionError, usingComparator, usingComparator, usingDefaultComparator, usingRecursiveComparison, usingRecursiveComparison, withFailMessage, withFailMessage, withRepresentation, withThreadDumpOnErrorclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitas, as, as, describedAsprotected Double2DArrays double2dArrays
public Double2DArrayAssert isDeepEqualTo(double[][] expected)
double[][] is deeply equal to the given one.
Two arrays are considered deeply equal if both are null
or if they refer to arrays that contain the same number of elements and
all corresponding pairs of elements in the two arrays are deeply equal.
Example:
// assertion will pass
assertThat(new double[][] {{1.0, 2.0}, {3.0, 4.0}}).isDeepEqualTo(new double[][] {{1.0, 2.0}, {3.0, 4.0}});
// assertions will fail
assertThat(new double[][] {{1.0, 2.0}, {3.0, 4.0}}).isDeepEqualTo(new double[][] {{1.0, 2.0}, {9.0, 10.0}});
assertThat(new double[][] {{1.0, 2.0}, {3.0, 4.0}}).isDeepEqualTo(new double[][] {{1.0, 2.0, 3.0}, {4.0}});isDeepEqualTo in class Abstract2DArrayAssert<Double2DArrayAssert,double[][],Double>expected - the given value to compare the actual value to.this assertion object.AssertionError - if the actual value is not deeply equal to the given one.public Double2DArrayAssert isEqualTo(Object expected)
double[][] is equal to the given one.
WARNING! This method will use equals to compare (it will compare arrays references only).
Unless you specify a comparator with AbstractAssert.usingComparator(Comparator), it is advised to use
isDeepEqualTo(double[][]) instead.
Example:
double[][] array = {{1.0, 2.0}, {3.0, 4.0}};
// assertion will pass
assertThat(array).isEqualTo(array);
// assertion will fail as isEqualTo calls equals which compares arrays references only.
assertThat(array).isEqualTo(new double[][] {{1.0, 2.0}, {3.0, 4.0}});isEqualTo in interface Assert<Double2DArrayAssert,double[][]>isEqualTo in class AbstractAssert<Double2DArrayAssert,double[][]>expected - the given value to compare the actual double[][] to.this assertion object.AssertionError - if the actual double[][] is not equal to the given one.public void isNullOrEmpty()
double[][] is null or empty, empty means the array has no elements,
said otherwise it can have any number of rows but all rows must be empty.
Example:
// assertions will pass
double[][] array = null;
assertThat(array).isNullOrEmpty();
assertThat(new double[][] { }).isNullOrEmpty();
assertThat(new double[][] {{ }}).isNullOrEmpty();
// this is considered empty as there are no elements in the 2d array which is comprised of 3 empty rows.
assertThat(new double[][] {{ }, { }, { }}).isNullOrEmpty();
// assertion will fail
assertThat(new double[][] {{ 1.0 }, { 2.0 }}).isNullOrEmpty();AssertionError - if the actual double[][] is not null or not empty.public void isEmpty()
double[][] is empty, empty means the array has no elements,
said otherwise it can have any number of rows but all rows must be empty.
Example:
// assertions will pass
assertThat(new double[][] {{}}).isEmpty();
// this is considered empty as there are no elements in the 2d array which is comprised of 3 empty rows.
assertThat(new double[][] {{ }, { }, { }}).isEmpty();
// assertions will fail
assertThat(new double[][] {{ 1.0 }, { 2.0 }}).isEmpty();
double[][] array = null;
assertThat(array).isEmpty();AssertionError - if the actual double[][] is not empty.public Double2DArrayAssert isNotEmpty()
double[][] is not empty, not empty means the array has at least one element.
Example:
// assertions will pass
assertThat(new double[][] {{ 1.0 }, { 2.0 }}).isNotEmpty();
assertThat(new double[][] {{ }, { 2.0 }}).isNotEmpty();
// assertions will fail
assertThat(new double[][] { }).isNotEmpty();
assertThat(new double[][] {{ }}).isNotEmpty();
// this is considered empty as there are no elements in the 2d array which is comprised of 3 empty rows.
assertThat(new double[][] {{ }, { }, { }}).isNotEmpty();
double[][] array = null;
assertThat(array).isNotEmpty();this assertion object.AssertionError - if the actual double[][] is empty or null.public Double2DArrayAssert hasDimensions(int expectedFirstDimension, int expectedSecondDimension)
double[][] has the given dimensions.
Example:
// assertion will pass
assertThat(new double[][] {{1.0, 2.0, 3.0}, {4.0, 5.0, 6.0}}).hasDimensions(2, 3);
// assertions will fail
assertThat(new double[][] { }).hasSize(1, 1);
assertThat(new double[][] {{1.0, 2.0, 3.0}, {4.0, 5.0, 6.0}}).hasDimensions(3, 2);
assertThat(new double[][] {{1.0, 2.0, 3.0}, {4.0, 5.0, 6.0, 7.0}}).hasDimensions(2, 3); expectedFirstDimension - the expected number of values in first dimension of the actual double[][].expectedSecondDimension - the expected number of values in second dimension of the actual double[][].this assertion object.AssertionError - if the actual double[][]'s dimensions are not equal to the given ones.public Double2DArrayAssert hasNumberOfRows(int expected)
Example:
// assertion will pass
assertThat(new double[][] {{1.0, 2.0, 3.0}, {4.0, 5.0, 6.0}}).hasNumberOfRows(2);
assertThat(new double[][] {{1.0}, {1.0, 2.0}, {1.0, 2.0, 3.0}}).hasNumberOfRows(3);
// assertions will fail
assertThat(new double[][] { }).hasNumberOfRows(1);
assertThat(new double[][] {{1.0, 2.0, 3.0}, {4.0, 5.0, 6.0}}).hasNumberOfRows(3);
assertThat(new double[][] {{1.0, 2.0, 3.0}, {4.0, 5.0, 6.0, 7.0}}).hasNumberOfRows(1); expected - the expected number of rows of the two-dimensional array.this assertion object.AssertionError - if the actual number of rows are not equal to the given one.public Double2DArrayAssert hasSameDimensionsAs(Object array)
double[][] has the same dimensions as the given array.
Parameter is declared as Object to accept both Object and primitive arrays.
Example: double[][] doubleArray = {{1.0, 2.0, 3.0}, {4.0, 5.0, 6.0}};
char[][] charArray = {{'a', 'b', 'c'}, {'d', 'e', 'f'}};
// assertion will pass
assertThat(doubleArray).hasSameDimensionsAs(charArray);
// assertions will fail
assertThat(doubleArray).hasSameDimensionsAs(new char[][] {{'a', 'b'}, {'c', 'd'}, {'e', 'f'}});
assertThat(doubleArray).hasSameDimensionsAs(new char[][] {{'a', 'b'}, {'c', 'd', 'e'}});
assertThat(doubleArray).hasSameDimensionsAs(new char[][] {{'a', 'b', 'c'}, {'d', 'e'}});array - the array to compare dimensions with actual double[][].this assertion object.AssertionError - if the actual double[][] is null.AssertionError - if the array parameter is null or is not a true array.AssertionError - if actual double[][] and given array don't have the same dimensions.public Double2DArrayAssert contains(double[] value, Index index)
double[][] contains the given double[] at the given index.
Example:
double[][] values = new double[][] {{1.0, 2.0}, {3.0, 4.0}, {5.0, 6.0}};
// assertion will pass
assertThat(values).contains(new double[] {1.0, 2.0}, atIndex(0))
.contains(new double[] {5.0, 6.0}, atIndex(2));
// assertions will fail
assertThat(values).contains(new double[] {1.0, 2.0}, atIndex(1));
assertThat(values).contains(new double[] {6.0, 10.0}, atIndex(2));value - the value to look for.index - the index where the value should be stored in the actual double[][].this assertion object.AssertionError - if the actual double[][] is null or empty.NullPointerException - if the given Index is null.IndexOutOfBoundsException - if the value of the given Index is equal to or greater than the size of
the actual double[][].AssertionError - if the actual double[][] does not contain the given value at the given index.public Double2DArrayAssert doesNotContain(double[] value, Index index)
double[][] does not contain the given double[] at the given index.
Example:
double[][] values = new double[][] {{1.0, 2.0}, {3.0, 4.0}, {5.0, 6.0}};
// assertion will pass
assertThat(values).doesNotContain(new double[] {1.0, 2.0}, atIndex(1))
.doesNotContain(new double[] {3.0, 4.0}, atIndex(0));
// assertion will fail
assertThat(values).doesNotContain(new double[] {1.0, 2.0}, atIndex(0));value - the value to look for.index - the index where the value should be stored in the actual double[][].this assertion object.AssertionError - if the actual double[][] is null.NullPointerException - if the given Index is null.AssertionError - if the actual double[][] contains the given value at the given index.Copyright © 2025. All rights reserved.