Java Array Equal equalOrDie(String testName, Object[] a, Object[] b)

Here you can find the source of equalOrDie(String testName, Object[] a, Object[] b)

Description

equal Or Die

License

Open Source License

Declaration

private static void equalOrDie(String testName, Object[] a, Object[] b) throws Exception 

Method Source Code


//package com.java2s;
/*/*from w ww.  j a  va  2  s.c o m*/
 * Copyright (C) 2005 Stephen Ostermiller
 * http://ostermiller.org/contact.pl?regarding=Java+Utilities
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * See COPYING.TXT for details.
 */

import java.util.*;

public class Main {
    private static void equalOrDie(String testName, Object[] a, Object[] b) throws Exception {
        if (!Arrays.equals(a, b)) {
            throw new Exception(testName + " failed, arrays are not equal");
        }
    }

    private static void equalOrDie(String testName, String a, String b) throws Exception {
        if (!a.equals(b)) {
            throw new Exception(testName + " failed, arrays are not equal");
        }
    }
}

Related

  1. equalByRows(boolean[][] a, boolean[][] b)
  2. equalFreqBinning(double[][] sampleData, int numPredVals, int numRespVals, int divInd)
  3. equalIgnoreOrder(final Object[] array1, final Object[] array2)
  4. equalityCheck(byte[] a, byte[] b)
  5. equalMaps(Map expected, Map actual)
  6. equals(byte[] a, byte[] b)
  7. equals(byte[] a1, byte[] a2)
  8. equals(byte[] data1, byte[] data2)
  9. equals(byte[] first, byte[] second)