• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 public class DxAbstractMain {
19 
assertEquals(int expected, int actual)20     static public void assertEquals(int expected, int actual) {
21         if (expected != actual) throw new RuntimeException("AssertionFailedError: not equals");
22     }
23 
assertEquals(long expected, long actual)24     static public void assertEquals(long expected, long actual) {
25         if (expected != actual) throw new RuntimeException("AssertionFailedError: not equals");
26     }
27 
assertEquals(double expected, double actual, double delta)28     static public void assertEquals(double expected, double actual, double delta) {
29         if(!(Math.abs(expected-actual) <= delta)) throw new RuntimeException("AssertionFailedError: not within delta");
30     }
31 
assertEquals(Object expected, Object actual)32     static public void assertEquals(Object expected, Object actual) {
33         if (expected == null && actual == null)
34             return;
35         if (expected != null && expected.equals(actual))
36             return;
37         throw new RuntimeException("AssertionFailedError: not the same");
38     }
39 
assertTrue(boolean condition)40     static public void assertTrue(boolean condition) {
41         if (!condition) throw new RuntimeException("AssertionFailedError: condition was false");
42     }
43 
assertFalse(boolean condition)44     static public void assertFalse(boolean condition) {
45         if (condition) throw new RuntimeException("AssertionFailedError: condition was true");
46     }
47 
assertNotNull(Object object)48     static public void assertNotNull(Object object) {
49         if (object == null) throw new RuntimeException("AssertionFailedError: object was null");
50     }
51 
assertNull(Object object)52     static public void assertNull(Object object) {
53         if (object != null) throw new RuntimeException("AssertionFailedError: object was not null");
54     }
55 
fail(String message)56     static public void fail(String message) {
57         throw new RuntimeException("AssertionFailedError msg:"+message);
58     }
59 
60 
61 }
62