Package org.fest.assertions.internal
Class ShortArrays
- java.lang.Object
 - 
- org.fest.assertions.internal.ShortArrays
 
 
- 
public class ShortArrays extends java.lang.ObjectReusable assertions for arrays ofshorts.- Author:
 - Alex Ruiz, Mikhail Mazursky, Nicolas François
 
 
- 
- 
Constructor Summary
Constructors Constructor Description ShortArrays(ComparisonStrategy comparisonStrategy) 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidassertContains(AssertionInfo info, short[] actual, short[] values)Asserts that the given array contains the given values, in any order.voidassertContains(AssertionInfo info, short[] actual, short value, Index index)Verifies that the given array contains the given value at the given index.voidassertContainsOnly(AssertionInfo info, short[] actual, short[] values)Asserts that the given array contains only the given values and nothing else, in any order.voidassertContainsSequence(AssertionInfo info, short[] actual, short[] sequence)Verifies that the given array contains the given sequence of values, without any other values between them.voidassertDoesNotContain(AssertionInfo info, short[] actual, short[] values)Asserts that the given array does not contain the given values.voidassertDoesNotContain(AssertionInfo info, short[] actual, short value, Index index)Verifies that the given array does not contain the given value at the given index.voidassertDoesNotHaveDuplicates(AssertionInfo info, short[] actual)Asserts that the given array does not have duplicate values.voidassertEmpty(AssertionInfo info, short[] actual)Asserts that the given array is empty.voidassertEndsWith(AssertionInfo info, short[] actual, short[] sequence)Verifies that the given array ends with the given sequence of values, without any other values between them.voidassertHasSameSizeAs(AssertionInfo info, short[] actual, java.lang.Iterable<?> other)Assert that the actual array has the same size as the otherIterable.voidassertHasSameSizeAs(AssertionInfo info, short[] actual, java.lang.Object[] other)Assert that the actual array has the same size as the other array.voidassertHasSize(AssertionInfo info, short[] actual, int expectedSize)Asserts that the number of elements in the given array is equal to the expected one.voidassertIsSorted(AssertionInfo info, short[] actual)Concrete implementation ofArraySortedAssert.isSorted().voidassertIsSortedAccordingToComparator(AssertionInfo info, short[] actual, java.util.Comparator<? super java.lang.Short> comparator)Concrete implementation ofArraySortedAssert.isSortedAccordingTo(Comparator).voidassertNotEmpty(AssertionInfo info, short[] actual)Asserts that the given array is not empty.voidassertNullOrEmpty(AssertionInfo info, short[] actual)Asserts that the given array isnullor empty.voidassertStartsWith(AssertionInfo info, short[] actual, short[] sequence)Verifies that the given array starts with the given sequence of values, without any other values between them.java.util.Comparator<?>getComparator()static ShortArraysinstance()Returns the singleton instance of this class. 
 - 
 
- 
- 
Constructor Detail
- 
ShortArrays
public ShortArrays(ComparisonStrategy comparisonStrategy)
 
 - 
 
- 
Method Detail
- 
instance
public static ShortArrays instance()
Returns the singleton instance of this class.- Returns:
 - the singleton instance of this class.
 
 
- 
getComparator
public java.util.Comparator<?> getComparator()
 
- 
assertNullOrEmpty
public void assertNullOrEmpty(AssertionInfo info, short[] actual)
Asserts that the given array isnullor empty.- Parameters:
 info- contains information about the assertion.actual- the given array.- Throws:
 java.lang.AssertionError- if the given array is notnull*and* contains one or more elements.
 
- 
assertEmpty
public void assertEmpty(AssertionInfo info, short[] actual)
Asserts that the given array is empty.- Parameters:
 info- contains information about the assertion.actual- the given array.- Throws:
 java.lang.AssertionError- if the given array isnull.java.lang.AssertionError- if the given array is not empty.
 
- 
assertNotEmpty
public void assertNotEmpty(AssertionInfo info, short[] actual)
Asserts that the given array is not empty.- Parameters:
 info- contains information about the assertion.actual- the given array.- Throws:
 java.lang.AssertionError- if the given array isnull.java.lang.AssertionError- if the given array is empty.
 
- 
assertHasSize
public void assertHasSize(AssertionInfo info, short[] actual, int expectedSize)
Asserts that the number of elements in the given array is equal to the expected one.- Parameters:
 info- contains information about the assertion.actual- the given array.expectedSize- the expected size ofactual.- Throws:
 java.lang.AssertionError- if the given array isnull.java.lang.AssertionError- if the number of elements in the given array is different than the expected one.
 
- 
assertHasSameSizeAs
public void assertHasSameSizeAs(AssertionInfo info, short[] actual, java.lang.Iterable<?> other)
Assert that the actual array has the same size as the otherIterable.- Parameters:
 info- contains information about the assertion.actual- the given array.other- the group to compare- Throws:
 java.lang.AssertionError- if the actual group isnull.java.lang.AssertionError- if the other group isnull.java.lang.AssertionError- if the actual group does not have the same size.
 
- 
assertHasSameSizeAs
public void assertHasSameSizeAs(AssertionInfo info, short[] actual, java.lang.Object[] other)
Assert that the actual array has the same size as the other array.- Parameters:
 info- contains information about the assertion.actual- the given array.other- the group to compare- Throws:
 java.lang.AssertionError- if the actual group isnull.java.lang.AssertionError- if the other group isnull.java.lang.AssertionError- if the actual group does not have the same size.
 
- 
assertContains
public void assertContains(AssertionInfo info, short[] actual, short[] values)
Asserts that the given array contains the given values, in any order.- Parameters:
 info- contains information about the assertion.actual- the given array.values- the values that are expected to be in the given array.- Throws:
 java.lang.NullPointerException- if the array of values isnull.java.lang.IllegalArgumentException- if the array of values is empty.java.lang.AssertionError- if the given array isnull.java.lang.AssertionError- if the given array does not contain the given values.
 
- 
assertContains
public void assertContains(AssertionInfo info, short[] actual, short value, Index index)
Verifies that the given array contains the given value at the given index.- Parameters:
 info- contains information about the assertion.actual- the given array.value- the value to look for.index- the index where the value should be stored in the given array.- Throws:
 java.lang.AssertionError- if the given array isnullor empty.java.lang.NullPointerException- if the givenIndexisnull.java.lang.IndexOutOfBoundsException- if the value of the givenIndexis equal to or greater than the size of the given array.java.lang.AssertionError- if the given array does not contain the given value at the given index.
 
- 
assertDoesNotContain
public void assertDoesNotContain(AssertionInfo info, short[] actual, short value, Index index)
Verifies that the given array does not contain the given value at the given index.- Parameters:
 info- contains information about the assertion.actual- the given array.value- the value to look for.index- the index where the value should be stored in the given array.- Throws:
 java.lang.AssertionError- if the given array isnull.java.lang.NullPointerException- if the givenIndexisnull.java.lang.AssertionError- if the given array contains the given value at the given index.
 
- 
assertContainsOnly
public void assertContainsOnly(AssertionInfo info, short[] actual, short[] values)
Asserts that the given array contains only the given values and nothing else, in any order.- Parameters:
 info- contains information about the assertion.actual- the given array.values- the values that are expected to be in the given array.- Throws:
 java.lang.NullPointerException- if the array of values isnull.java.lang.IllegalArgumentException- if the array of values is empty.java.lang.AssertionError- if the given array isnull.java.lang.AssertionError- if the given array does not contain the given values or if the given array contains values that are not in the given array.
 
- 
assertContainsSequence
public void assertContainsSequence(AssertionInfo info, short[] actual, short[] sequence)
Verifies that the given array contains the given sequence of values, without any other values between them.- Parameters:
 info- contains information about the assertion.actual- the given array.sequence- the sequence of values to look for.- Throws:
 java.lang.AssertionError- if the given array isnull.java.lang.NullPointerException- if the given sequence isnull.java.lang.IllegalArgumentException- if the given sequence is empty.java.lang.AssertionError- if the given array does not contain the given sequence of values.
 
- 
assertDoesNotContain
public void assertDoesNotContain(AssertionInfo info, short[] actual, short[] values)
Asserts that the given array does not contain the given values.- Parameters:
 info- contains information about the assertion.actual- the given array.values- the values that are expected not to be in the given array.- Throws:
 java.lang.NullPointerException- if the array of values isnull.java.lang.IllegalArgumentException- if the array of values is empty.java.lang.AssertionError- if the given array isnull.java.lang.AssertionError- if the given array contains any of given values.
 
- 
assertDoesNotHaveDuplicates
public void assertDoesNotHaveDuplicates(AssertionInfo info, short[] actual)
Asserts that the given array does not have duplicate values.- Parameters:
 info- contains information about the assertion.actual- the given array.- Throws:
 java.lang.NullPointerException- if the array of values isnull.java.lang.IllegalArgumentException- if the array of values is empty.java.lang.AssertionError- if the given array isnull.java.lang.AssertionError- if the given array contains duplicate values.
 
- 
assertStartsWith
public void assertStartsWith(AssertionInfo info, short[] actual, short[] sequence)
Verifies that the given array starts with the given sequence of values, without any other values between them. Similar to, but it also verifies that the first element in the sequence is also the first element of the given array.assertContainsSequence(AssertionInfo, short[], short[])- Parameters:
 info- contains information about the assertion.actual- the given array.sequence- the sequence of values to look for.- Throws:
 java.lang.NullPointerException- if the given argument isnull.java.lang.IllegalArgumentException- if the given argument is an empty array.java.lang.AssertionError- if the given array isnull.java.lang.AssertionError- if the given array does not start with the given sequence of values.
 
- 
assertEndsWith
public void assertEndsWith(AssertionInfo info, short[] actual, short[] sequence)
Verifies that the given array ends with the given sequence of values, without any other values between them. Similar to, but it also verifies that the last element in the sequence is also the last element of the given array.assertContainsSequence(AssertionInfo, short[], short[])- Parameters:
 info- contains information about the assertion.actual- the given array.sequence- the sequence of values to look for.- Throws:
 java.lang.NullPointerException- if the given argument isnull.java.lang.IllegalArgumentException- if the given argument is an empty array.java.lang.AssertionError- if the given array isnull.java.lang.AssertionError- if the given array does not end with the given sequence of values.
 
- 
assertIsSorted
public void assertIsSorted(AssertionInfo info, short[] actual)
Concrete implementation ofArraySortedAssert.isSorted().- Parameters:
 info- contains information about the assertion.actual- the given array.
 
- 
assertIsSortedAccordingToComparator
public void assertIsSortedAccordingToComparator(AssertionInfo info, short[] actual, java.util.Comparator<? super java.lang.Short> comparator)
Concrete implementation ofArraySortedAssert.isSortedAccordingTo(Comparator).- Parameters:
 info- contains information about the assertion.actual- the given array.comparator- theComparatorused to compare array elements
 
 - 
 
 -