1 /* 2 * Copyright (C) 2008 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 package dxc.junit; 17 18 import junit.framework.TestCase; 19 20 public class DxTestCase extends TestCase { 21 22 // omit the "extends TestCase" and uncomment the following methods if you would like to run the tests as rolled-out, separate tests. 23 24 /* 25 static public void assertEquals(int expected, int actual) { 26 if (expected != actual) throw new RuntimeException("AssertionFailedError: not equals"); 27 } 28 29 static public void assertEquals(long expected, long actual) { 30 if (expected != actual) throw new RuntimeException("AssertionFailedError: not equals"); 31 } 32 33 static public void assertEquals(double expected, double actual, double delta) { 34 if(!(Math.abs(expected-actual) <= delta)) throw new RuntimeException("AssertionFailedError: not within delta"); 35 } 36 37 static public void assertEquals(Object expected, Object actual) { 38 if (expected == null && actual == null) 39 return; 40 if (expected != null && expected.equals(actual)) 41 return; 42 throw new RuntimeException("AssertionFailedError: not the same"); 43 } 44 45 static public void assertTrue(boolean condition) { 46 if (!condition) throw new RuntimeException("AssertionFailedError: condition was false"); 47 } 48 49 static public void assertFalse(boolean condition) { 50 if (condition) throw new RuntimeException("AssertionFailedError: condition was true"); 51 } 52 53 static public void assertNotNull(Object object) { 54 if (object == null) throw new RuntimeException("AssertionFailedError: object was null"); 55 } 56 57 static public void assertNull(Object object) { 58 if (object != null) throw new RuntimeException("AssertionFailedError: object was not null"); 59 } 60 61 static public void fail(String message) { 62 throw new RuntimeException("AssertionFailedError msg:"+message); 63 } 64 */ 65 66 67 } 68