Package org.fest.assertions
Class DoubleArrayAssert
java.lang.Object
org.fest.assertions.Assert
org.fest.assertions.GenericAssert<T>
org.fest.assertions.GroupAssert<T>
org.fest.assertions.ItemGroupAssert<T>
org.fest.assertions.ArrayAssert<double[]>
org.fest.assertions.DoubleArrayAssert
Understands assertion methods for
double arrays. To create a new instance of this class use the method
Assertions.assertThat(double[]).-
Field Summary
Fields inherited from class org.fest.assertions.GenericAssert
actual -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDoubleArrayAssert(double... actual) Creates a newDoubleArrayAssert. -
Method Summary
Modifier and TypeMethodDescriptionSets the description of the actual value, to be used in as message of anythrown when an assertion fails.AssertionErroras(Description description) Sets the description of the actual value, to be used in as message of anythrown when an assertion fails.AssertionErrorcontains(double... values) Verifies that the actualdoublearray contains the given values.containsOnly(double... values) Verifies that the actualdoublearray contains the given values only.describedAs(String description) Alias for, since "as" is a keyword in Groovy.GenericAssert.as(String)describedAs(Description description) Alias for, since "as" is a keyword in Groovy.GenericAssert.as(Description)doesNotSatisfy(Condition<double[]> condition) Verifies that the actualdoublearray does not satisfy the given condition.private booleanexcludes(double... values) Verifies that the actualdoublearray does not contain the given values.private AssertionErrorfailureWhenNotEqual(double[] expected, Delta delta) hasSize(int expected) Verifies that the number of elements in the actualdoublearray is equal to the given one.Alias for.satisfies(Condition)isEqualTo(double[] expected) Verifies that the actualdoublearray is equal to the given array.Verifies that the actualdoublearray is equal to the given array, within a positive delta.Alias for.doesNotSatisfy(Condition)Verifies that the actualdoublearray contains at least on element.isNotEqualTo(double[] array) Verifies that the actualdoublearray is not equal to the given array.Verifies that the actualdoublearray is notnull.isNotSameAs(double[] expected) Verifies that the actualdoublearray is not the same as the given array.isSameAs(double[] expected) Verifies that the actualdoublearray is the same as the given array.overridingErrorMessage(String message) Replaces the default message displayed in case of a failure with the given one.Verifies that the actualdoublearray satisfies the given condition.Methods inherited from class org.fest.assertions.ArrayAssert
actualAsList, actualAsSet, actualGroupSizeMethods inherited from class org.fest.assertions.ItemGroupAssert
assertContains, assertContainsOnly, assertDoesNotHaveDuplicates, assertExcludes, asSet, validateIsNotNullMethods inherited from class org.fest.assertions.GroupAssert
assertHasSize, assertIsNotEmpty, isEmpty, isNullOrEmptyMethods inherited from class org.fest.assertions.GenericAssert
assertDoesNotSatisfy, assertEqualTo, assertIs, assertIsNot, assertNotEqualTo, assertNotNull, assertNotSameAs, assertSameAs, assertSatisfies, isNullMethods inherited from class org.fest.assertions.Assert
customErrorMessage, description, description, description, equals, fail, fail, failIfCustomMessageIsSet, failIfCustomMessageIsSet, failure, formattedErrorMessage, hashCode, rawDescription, replaceDefaultErrorMessagesWith
-
Constructor Details
-
DoubleArrayAssert
protected DoubleArrayAssert(double... actual) Creates a newDoubleArrayAssert.- Parameters:
actual- the target to verify.
-
-
Method Details
-
as
Sets the description of the actual value, to be used in as message of anythrown when an assertion fails. This method should be called before any assertion method, otherwise any assertion failure will not show the provided description.AssertionErrorFor example:
assertThat(val).as("name").isEqualTo("Frodo");- Specified by:
asin classGroupAssert<double[]>- Parameters:
description- the description of the actual value.- Returns:
- this assertion object.
-
describedAs
Alias for, since "as" is a keyword in Groovy. This method should be called before any assertion method, otherwise any assertion failure will not show the provided description.GenericAssert.as(String)For example:
assertThat(val).describedAs("name").isEqualTo("Frodo");- Specified by:
describedAsin classGroupAssert<double[]>- Parameters:
description- the description of the actual value.- Returns:
- this assertion object.
-
as
Sets the description of the actual value, to be used in as message of anythrown when an assertion fails. This method should be called before any assertion method, otherwise any assertion failure will not show the provided description.AssertionErrorFor example:
assertThat(val).as(new BasicDescription("name")).isEqualTo("Frodo");- Specified by:
asin classGroupAssert<double[]>- Parameters:
description- the description of the actual value.- Returns:
- this assertion object.
-
describedAs
Alias for, since "as" is a keyword in Groovy. This method should be called before any assertion method, otherwise any assertion failure will not show the provided description.GenericAssert.as(Description)For example:
assertThat(val).describedAs(new BasicDescription("name")).isEqualTo("Frodo");- Specified by:
describedAsin classGroupAssert<double[]>- Parameters:
description- the description of the actual value.- Returns:
- this assertion object.
-
contains
Verifies that the actualdoublearray contains the given values.- Parameters:
values- the values to look for.- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualdoublearray isnull.NullPointerException- if the givendoublearray isnull.AssertionError- if the actualdoublearray does not contain the given values.
-
containsOnly
Verifies that the actualdoublearray contains the given values only.- Parameters:
values- the values to look for.- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualdoublearray isnull.NullPointerException- if the givendoublearray isnull.AssertionError- if the actualdoublearray does not contain the given objects, or if the actualdoublearray contains elements other than the ones specified.
-
excludes
Verifies that the actualdoublearray does not contain the given values.- Parameters:
values- the values the array should exclude.- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualdoublearray isnull.NullPointerException- if the givendoublearray isnull.AssertionError- if the actualdoublearray contains any of the given values.
-
satisfies
Verifies that the actualdoublearray satisfies the given condition.- Specified by:
satisfiesin classGenericAssert<double[]>- Parameters:
condition- the given condition.- Returns:
- this assertion object.
- Throws:
NullPointerException- if the given condition isnull.AssertionError- if the actualdoublearray does not satisfy the given condition.- See Also:
-
doesNotSatisfy
Verifies that the actualdoublearray does not satisfy the given condition.- Specified by:
doesNotSatisfyin classGenericAssert<double[]>- Parameters:
condition- the given condition.- Returns:
- this assertion object.
- Throws:
NullPointerException- if the given condition isnull.AssertionError- if the actualdoublearray satisfies the given condition.- See Also:
-
is
Alias for.satisfies(Condition)- Specified by:
isin classGenericAssert<double[]>- Parameters:
condition- the given condition.- Returns:
- this assertion object.
- Throws:
NullPointerException- if the given condition isnull.AssertionError- if the actualdoublearray does not satisfy the given condition.- Since:
- 1.2
-
isNot
Alias for.doesNotSatisfy(Condition)- Specified by:
isNotin classGenericAssert<double[]>- Parameters:
condition- the given condition.- Returns:
- this assertion object.
- Throws:
NullPointerException- if the given condition isnull.AssertionError- if the actualdoublearray satisfies the given condition.- Since:
- 1.2
-
isNotNull
Verifies that the actualdoublearray is notnull.- Specified by:
isNotNullin classGenericAssert<double[]>- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualdoublearray isnull.
-
isNotEmpty
Verifies that the actualdoublearray contains at least on element.- Specified by:
isNotEmptyin classGroupAssert<double[]>- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualdoublearray isnull.AssertionError- if the actualdoublearray is empty.
-
isEqualTo
Verifies that the actualdoublearray is equal to the given array. Array equality is checked by.Arrays.equals(double[], double[])- Specified by:
isEqualToin classGenericAssert<double[]>- Parameters:
expected- the given array to compare the actual array to.- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualdoublearray is not equal to the given one.
-
isEqualTo
Verifies that the actualdoublearray is equal to the given array, within a positive delta.- Parameters:
expected- the given array to compare the actual array to.delta- the given delta.- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualdoublearray is not equal to the given one.- Since:
- 1.1
-
failureWhenNotEqual
-
equals
-
isNotEqualTo
Verifies that the actualdoublearray is not equal to the given array. Array equality is checked by.Arrays.equals(double[], double[])- Specified by:
isNotEqualToin classGenericAssert<double[]>- Parameters:
array- the given array to compare the actual array to.- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualdoublearray is equal to the given one.
-
hasSize
Verifies that the number of elements in the actualdoublearray is equal to the given one.- Specified by:
hasSizein classGroupAssert<double[]>- Parameters:
expected- the expected number of elements in the actualdoublearray.- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualdoublearray isnull.AssertionError- if the number of elements in the actualdoublearray is not equal to the given one.
-
isSameAs
Verifies that the actualdoublearray is the same as the given array.- Specified by:
isSameAsin classGenericAssert<double[]>- Parameters:
expected- the given array to compare the actual array to.- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualdoublearray is not the same as the given one.
-
isNotSameAs
Verifies that the actualdoublearray is not the same as the given array.- Specified by:
isNotSameAsin classGenericAssert<double[]>- Parameters:
expected- the given array to compare the actual array to.- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualdoublearray is the same as the given one.
-
overridingErrorMessage
Replaces the default message displayed in case of a failure with the given one.For example, the following assertion:
assertThat("Hello").isEqualTo("Bye");will fail with the default message "expected:<'[Bye]'> but was:<'[Hello]'>."We can replace this message with our own:
assertThat("Hello").overridingErrorMessage("'Hello' should be equal to 'Bye'").isEqualTo("Bye");in this case, the assertion will fail showing the message "'Hello' should be equal to 'Bye'".- Specified by:
overridingErrorMessagein classGroupAssert<double[]>- Parameters:
message- the given error message, which will replace the default one.- Returns:
- this assertion.
-