1 /* 2 * Copyright (C) 2013 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package org.junit; 18 19 //Note: this class was written without inspecting the junit code 20 21 import java.util.Arrays; 22 23 public class Assert extends junit.framework.Assert { Assert()24 protected Assert() { 25 } 26 assertArrayEquals(byte[] expecteds, byte[] actuals)27 public static void assertArrayEquals(byte[] expecteds, byte[] actuals) { 28 assertArrayEquals("", expecteds, actuals); 29 } 30 assertArrayEquals(String message, byte[] expecteds, byte[] actuals)31 public static void assertArrayEquals(String message, byte[] expecteds, byte[] actuals) { 32 String expectedString = Arrays.toString(expecteds); 33 String actualString = Arrays.toString(actuals); 34 35 if (!expectedString.equals(actualString)) { 36 fail(message, "expected " + expectedString + " but was " + actualString); 37 } 38 } 39 assertArrayEquals(char[] expecteds, char[] actuals)40 public static void assertArrayEquals(char[] expecteds, char[] actuals) { 41 assertArrayEquals("", expecteds, actuals); 42 } 43 assertArrayEquals(String message, char[] expecteds, char[] actuals)44 public static void assertArrayEquals(String message, char[] expecteds, char[] actuals) { 45 String expectedString = Arrays.toString(expecteds); 46 String actualString = Arrays.toString(actuals); 47 48 if (!expectedString.equals(actualString)) { 49 fail(message, "expected " + expectedString + " but was " + actualString); 50 } 51 } 52 assertArrayEquals(int[] expecteds, int[] actuals)53 public static void assertArrayEquals(int[] expecteds, int[] actuals) { 54 assertArrayEquals("", expecteds, actuals); 55 } 56 assertArrayEquals(String message, int[] expecteds, int[] actuals)57 public static void assertArrayEquals(String message, int[] expecteds, int[] actuals) { 58 String expectedString = Arrays.toString(expecteds); 59 String actualString = Arrays.toString(actuals); 60 61 if (!expectedString.equals(actualString)) { 62 fail(message, "expected " + expectedString + " but was " + actualString); 63 } 64 } 65 assertArrayEquals(long[] expecteds, long[] actuals)66 public static void assertArrayEquals(long[] expecteds, long[] actuals) { 67 assertArrayEquals("", expecteds, actuals); 68 } 69 assertArrayEquals(String message, long[] expecteds, long[] actuals)70 public static void assertArrayEquals(String message, long[] expecteds, long[] actuals) { 71 String expectedString = Arrays.toString(expecteds); 72 String actualString = Arrays.toString(actuals); 73 74 if (!expectedString.equals(actualString)) { 75 fail(message, "expected " + expectedString + " but was " + actualString); 76 } 77 } 78 assertArrayEquals(Object[] expecteds, Object[] actuals)79 public static void assertArrayEquals(Object[] expecteds, Object[] actuals) { 80 assertArrayEquals("", expecteds, actuals); 81 } 82 assertArrayEquals(String message, Object[] expecteds, Object[] actuals)83 public static void assertArrayEquals(String message, Object[] expecteds, Object[] actuals) { 84 String expectedString = Arrays.toString(expecteds); 85 String actualString = Arrays.toString(actuals); 86 87 if (!expectedString.equals(actualString)) { 88 fail(message, "expected " + expectedString + " but was " + actualString); 89 } 90 } 91 assertArrayEquals(short[] expecteds, short[] actuals)92 public static void assertArrayEquals(short[] expecteds, short[] actuals) { 93 assertArrayEquals("", expecteds, actuals); 94 } 95 assertArrayEquals(String message, short[] expecteds, short[] actuals)96 public static void assertArrayEquals(String message, short[] expecteds, short[] actuals) { 97 String expectedString = Arrays.toString(expecteds); 98 String actualString = Arrays.toString(actuals); 99 100 if (!expectedString.equals(actualString)) { 101 fail(message, "expected " + expectedString + " but was " + actualString); 102 } 103 } 104 } 105