Java Assert Equal assertArrayLengthEqual(Object[] array, String name, Object[] array1, String name1)

Here you can find the source of assertArrayLengthEqual(Object[] array, String name, Object[] array1, String name1)

Description

Check if the lengths of the two arrays are equal.

License

Open Source License

Parameter

Parameter Description
array the given array to check
array1 the given array to check
name the name to identify array.
name1 the name to identify array1.

Exception

Parameter Description
IllegalArgumentException if length of array is different from that of array1.

Declaration

static void assertArrayLengthEqual(Object[] array, String name,
        Object[] array1, String name1) 

Method Source Code

//package com.java2s;

public class Main {
    /**//from   w w  w  .java2s . c o m
     * Check if the lengths of the two arrays are equal.
     * @param array
     *            the given array to check
     * @param array1
     *            the given array to check
     * @param name
     *            the name to identify array.
     * @param name1
     *            the name to identify array1.
     * @throws IllegalArgumentException
     *             if length of array is different from that of array1.
     */
    static void assertArrayLengthEqual(Object[] array, String name,
            Object[] array1, String name1) {
        if (array.length != array1.length) {
            throw new IllegalArgumentException("The length of " + name
                    + " should be the same as that of " + name1);
        }
    }
}

Related

  1. assertAboveEqual(final double number, final double value)
  2. assertApproxEquals(double a, double b, double relative, double absolute)
  3. assertArrayEquals(double[] p1, double[] p2, double eps)
  4. assertCharacterArraysEqual(char[] first, char[] second)
  5. assertDatesEqual(Calendar first, Calendar second)
  6. assertEqual(final double d1, final double d2, final double precisionRange)
  7. assertEqual(Object obj1, Object obj2)