Class Short2DArrayAssert

    • Field Detail

      • failures

        private final org.assertj.core.internal.Failures failures
      • short2dArrays

        protected org.assertj.core.internal.Short2DArrays short2dArrays
    • Constructor Detail

      • Short2DArrayAssert

        public Short2DArrayAssert​(short[][] actual)
    • Method Detail

      • isDeepEqualTo

        public Short2DArrayAssert isDeepEqualTo​(short[][] expected)
        Verifies that the actual short[][] 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 short[][] {{1, 2}, {3, 4}}).isDeepEqualTo(new short[][] {{1, 2}, {3, 4}});
        
         // assertions will fail
         assertThat(new short[][] {{1, 2}, {3, 4}}).isDeepEqualTo(new short[][] {{1, 2}, {9, 10}});
         assertThat(new short[][] {{1, 2}, {3, 4}}).isDeepEqualTo(new short[][] {{1, 2, 3}, {4}});
        Specified by:
        isDeepEqualTo in class Abstract2DArrayAssert<Short2DArrayAssert,​short[][],​Short>
        Parameters:
        expected - the given value to compare the actual short[][] to.
        Returns:
        this assertion object.
        Throws:
        AssertionError - if the actual short[][] is not deeply equal to the given one.
      • isEqualTo

        public Short2DArrayAssert isEqualTo​(Object expected)
        Verifies that the actual short[][] 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(short[][]) instead.

        Example:

         short[][] array = {{1, 2}, {3, 4}};
        
         // assertion will pass
         assertThat(array).isEqualTo(array);
        
         // assertion will fail as isEqualTo calls equals which compares arrays references only.
         assertThat(array).isEqualTo(new short[][] {{1, 2}, {3, 4}});
        Specified by:
        isEqualTo in interface Assert<Short2DArrayAssert,​short[][]>
        Overrides:
        isEqualTo in class AbstractAssert<Short2DArrayAssert,​short[][]>
        Parameters:
        expected - the given value to compare the actual short[][] to.
        Returns:
        this assertion object.
        Throws:
        AssertionError - if the actual short[][] is not equal to the given one.
      • isNullOrEmpty

        public void isNullOrEmpty()
        Verifies that the actual short[][] 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
         short[][] array = null;
         assertThat(array).isNullOrEmpty();
         assertThat(new short[][] { }).isNullOrEmpty();
         assertThat(new short[][] {{ }}).isNullOrEmpty();
         // this is considered empty as there are no elements in the 2d array which is comprised of 3 empty rows.
         assertThat(new short[][] {{ }, { }, { }}).isNullOrEmpty();
        
         // assertion will fail
         assertThat(new short[][] {{ 1 }, { 2 }}).isNullOrEmpty();
        Throws:
        AssertionError - if the actual short[][] is not null or not empty.
      • isEmpty

        public void isEmpty()
        Verifies that the actual short[][] 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:

         // assertion will pass
         assertThat(new short[][] {{}}).isEmpty();
         assertThat(new short[][] {{ }}).isNullOrEmpty();
         // this is considered empty as there are no elements in the 2d array which is comprised of 3 empty rows.
         assertThat(new short[][] {{ }, { }, { }}).isNullOrEmpty();
        
         // assertions will fail
         assertThat(new short[][] {{ 1 }, { 2 }}).isEmpty();
         short[][] array = null;
         assertThat(array).isEmpty();
        Throws:
        AssertionError - if the actual short[][] is not empty.
      • isNotEmpty

        public Short2DArrayAssert isNotEmpty()
        Verifies that the actual short[][] is not empty, not empty means the array has at least one element.

        Example:

         // assertions will pass
         assertThat(new short[][] {{ 1 }, { 2 }}).isNotEmpty();
         assertThat(new short[][] {{ }, { 2 }}).isNotEmpty();
        
         // assertions will fail
         assertThat(new short[][] { }).isNotEmpty();
         assertThat(new short[][] {{ }}).isNotEmpty();
         // this is considered empty as there are no elements in the 2d array which is comprised of 3 empty rows.
         assertThat(new short[][] {{ }, { }, { }}).isNotEmpty();
         short[][] array = null;
         assertThat(array).isNotEmpty();
        Returns:
        this assertion object.
        Throws:
        AssertionError - if the actual short[][] is empty or null.
      • hasDimensions

        public Short2DArrayAssert hasDimensions​(int expectedFirstDimension,
                                                int expectedSecondDimension)
        Verifies that the actual 2D array has the given dimensions.

        Example:

         // assertion will pass
         assertThat(new short[][] {{1, 2, 3}, {4, 5, 6}}).hasDimensions(2, 3);
        
         // assertions will fail
         assertThat(new short[][] { }).hasSize(1, 1);
         assertThat(new short[][] {{1, 2, 3}, {4, 5, 6}}).hasDimensions(3, 2);
         assertThat(new short[][] {{1, 2, 3}, {4, 5, 6, 7}}).hasDimensions(2, 3); 
        Parameters:
        expectedFirstDimension - the expected number of values in first dimension of the actual short[][].
        expectedSecondDimension - the expected number of values in second dimension of the actual short[][].
        Returns:
        this assertion object.
        Throws:
        AssertionError - if the actual short[][]'s dimensions are not equal to the given ones.
      • hasSameDimensionsAs

        public Short2DArrayAssert hasSameDimensionsAs​(Object array)
        Verifies that the actual short[][] has the same dimensions as the given array.

        Parameter is declared as Object to accept both Object and primitive arrays.

        Example:
         short[][] shortArray = {{1, 2, 3}, {4, 5, 6}};
         char[][] charArray = {{'a', 'b', 'c'}, {'d', 'e', 'f'}};
        
         // assertion will pass
         assertThat(shortArray).hasSameDimensionsAs(charArray);
        
         // assertions will fail
         assertThat(shortArray).hasSameDimensionsAs(new char[][] {{'a', 'b'}, {'c', 'd'}, {'e', 'f'}});
         assertThat(shortArray).hasSameDimensionsAs(new char[][] {{'a', 'b'}, {'c', 'd', 'e'}});
         assertThat(shortArray).hasSameDimensionsAs(new char[][] {{'a', 'b', 'c'}, {'d', 'e'}});
        Parameters:
        array - the array to compare dimensions with actual short[][].
        Returns:
        this assertion object.
        Throws:
        AssertionError - if the actual short[][] is null.
        AssertionError - if the array parameter is null or is not a true array.
        AssertionError - if actual short[][] and given array don't have the same dimensions.
      • contains

        public Short2DArrayAssert contains​(short[] value,
                                           Index index)
        Verifies that the actual short[][] contains the given short[] at the given index.

        Example:

         // assertion will pass
         assertThat(new short[][] {{1, 2}, {3, 4}, {5, 6}}).contains(new short[] {3, 4}, atIndex(1));
        
         // assertions will fail
         assertThat(new short[][] {{1, 2}, {3, 4}, {5, 6}}).contains(new short[] {3, 4}, atIndex(0));
         assertThat(new short[][] {{1, 2}, {3, 4}, {5, 6}}).contains(new short[] {7, 8}, atIndex(2));
        Parameters:
        value - the value to look for.
        index - the index where the value should be stored in the actual short[][].
        Returns:
        myself assertion object.
        Throws:
        AssertionError - if the actual short[][] 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 short[][].
        AssertionError - if the actual short[][] does not contain the given value at the given index.
      • contains

        public Short2DArrayAssert contains​(int[] value,
                                           Index index)
        Verifies that the actual short[][] contains the given short[] at the given index.

        Example:

         // assertions will pass
         assertThat(new short[][] {{1, 2}, {3, 4}, {5, 6}}).doesNotContain(new short[] {3, 4}, atIndex(0));
         assertThat(new short[][] {{1, 2}, {3, 4}, {5, 6}}).doesNotContain(new short[] {7, 8}, atIndex(2));
        
         // assertion will fail
         assertThat(new short[][] {{1, 2}, {3, 4}, {5, 6}}).doesNotContain(new short[] {3, 4}, atIndex(1));
        Parameters:
        value - the value to look for.
        index - the index where the value should be stored in the actual short[][].
        Returns:
        myself assertion object.
        Throws:
        AssertionError - if the actual short[][] 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 short[][].
        AssertionError - if the actual short[][] does not contain the given value at the given index.
      • doesNotContain

        public Short2DArrayAssert doesNotContain​(short[] value,
                                                 Index index)
        Verifies that the actual short[][] does not contain the given short[] at the given index.

        Example:

         // assertions will pass
         assertThat(new short[] { 1, 2, 3 }).doesNotContain((short) 1, atIndex(1));
         assertThat(new short[] { 1, 2, 3 }).doesNotContain((short) 2, atIndex(0));
        
         // assertions will fail
         assertThat(new short[] { 1, 2, 3 }).doesNotContain((short) 1, atIndex(0));
         assertThat(new short[] { 1, 2, 3 }).doesNotContain((short) 2, atIndex(1));
        Parameters:
        value - the value to look for.
        index - the index where the value should be stored in the actual short[][].
        Returns:
        myself assertion object.
        Throws:
        AssertionError - if the actual short[][] is null.
        NullPointerException - if the given Index is null.
        AssertionError - if the actual short[][] contains the given value at the given index.
      • doesNotContain

        public Short2DArrayAssert doesNotContain​(int[] value,
                                                 Index index)
        Verifies that the actual short[][] does not contain the given short[] at the given index.

        Example:

         // assertions will pass
         assertThat(new short[] { 1, 2, 3 }).doesNotContain(1, atIndex(1));
         assertThat(new short[] { 1, 2, 3 }).doesNotContain(2, atIndex(0));
        
         // assertions will fail
         assertThat(new short[] { 1, 2, 3 }).doesNotContain(1, atIndex(0));
         assertThat(new short[] { 1, 2, 3 }).doesNotContain(2, atIndex(1));
        Parameters:
        value - the value to look for.
        index - the index where the value should be stored in the actual short[][].
        Returns:
        myself assertion object.
        Throws:
        AssertionError - if the actual short[][] is null.
        NullPointerException - if the given Index is null.
        AssertionError - if the actual short[][] contains the given value at the given index.
      • toShort

        private static short[] toShort​(int[] value)