author | duke |
Wed, 05 Jul 2017 22:05:30 +0200 | |
changeset 40321 | 4ad540e56bde |
parent 30902 | cf3d869e9f79 |
permissions | -rw-r--r-- |
21662
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
1 |
/* |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
2 |
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
4 |
* |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
8 |
* |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
13 |
* accompanied this code). |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
14 |
* |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
18 |
* |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
21 |
* questions. |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
22 |
*/ |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
23 |
|
30902 | 24 |
import java.lang.SuppressWarnings; |
25 |
||
21662
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
26 |
import static jdk.testlibrary.Asserts.*; |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
27 |
|
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
28 |
/* @test |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
29 |
* @summary Tests the different assertions in the Assert class |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
30 |
*/ |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
31 |
public class AssertsTest { |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
32 |
private static class Foo implements Comparable<Foo> { |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
33 |
final int id; |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
34 |
public Foo(int id) { |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
35 |
this.id = id; |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
36 |
} |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
37 |
|
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
38 |
public int compareTo(Foo f) { |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
39 |
return new Integer(id).compareTo(new Integer(f.id)); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
40 |
} |
23036
b711f9772be8
8035889: jdk testlibrary - add printing of values of failed assertions
rriggs
parents:
21662
diff
changeset
|
41 |
public String toString() { |
b711f9772be8
8035889: jdk testlibrary - add printing of values of failed assertions
rriggs
parents:
21662
diff
changeset
|
42 |
return "Foo(" + Integer.toString(id) + ")"; |
b711f9772be8
8035889: jdk testlibrary - add printing of values of failed assertions
rriggs
parents:
21662
diff
changeset
|
43 |
} |
21662
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
44 |
} |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
45 |
|
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
46 |
public static void main(String[] args) throws Exception { |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
47 |
testLessThan(); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
48 |
testLessThanOrEqual(); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
49 |
testEquals(); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
50 |
testGreaterThanOrEqual(); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
51 |
testGreaterThan(); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
52 |
testNotEquals(); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
53 |
testNull(); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
54 |
testNotNull(); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
55 |
testTrue(); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
56 |
testFalse(); |
23036
b711f9772be8
8035889: jdk testlibrary - add printing of values of failed assertions
rriggs
parents:
21662
diff
changeset
|
57 |
testFail(); |
21662
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
58 |
} |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
59 |
|
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
60 |
private static void testLessThan() throws Exception { |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
61 |
expectPass(Assertion.LT, 1, 2); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
62 |
|
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
63 |
expectFail(Assertion.LT, 2, 2); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
64 |
expectFail(Assertion.LT, 2, 1); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
65 |
expectFail(Assertion.LT, null, 2); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
66 |
expectFail(Assertion.LT, 2, null); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
67 |
} |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
68 |
|
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
69 |
private static void testLessThanOrEqual() throws Exception { |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
70 |
expectPass(Assertion.LTE, 1, 2); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
71 |
expectPass(Assertion.LTE, 2, 2); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
72 |
|
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
73 |
expectFail(Assertion.LTE, 3, 2); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
74 |
expectFail(Assertion.LTE, null, 2); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
75 |
expectFail(Assertion.LTE, 2, null); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
76 |
} |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
77 |
|
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
78 |
private static void testEquals() throws Exception { |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
79 |
expectPass(Assertion.EQ, 1, 1); |
30902 | 80 |
expectPass(Assertion.EQ, (Integer)null, (Integer)null); |
21662
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
81 |
|
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
82 |
Foo f1 = new Foo(1); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
83 |
expectPass(Assertion.EQ, f1, f1); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
84 |
|
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
85 |
Foo f2 = new Foo(1); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
86 |
expectFail(Assertion.EQ, f1, f2); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
87 |
expectFail(Assertion.LTE, null, 2); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
88 |
expectFail(Assertion.LTE, 2, null); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
89 |
} |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
90 |
|
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
91 |
private static void testGreaterThanOrEqual() throws Exception { |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
92 |
expectPass(Assertion.GTE, 1, 1); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
93 |
expectPass(Assertion.GTE, 2, 1); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
94 |
|
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
95 |
expectFail(Assertion.GTE, 1, 2); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
96 |
expectFail(Assertion.GTE, null, 2); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
97 |
expectFail(Assertion.GTE, 2, null); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
98 |
} |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
99 |
|
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
100 |
private static void testGreaterThan() throws Exception { |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
101 |
expectPass(Assertion.GT, 2, 1); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
102 |
|
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
103 |
expectFail(Assertion.GT, 1, 1); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
104 |
expectFail(Assertion.GT, 1, 2); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
105 |
expectFail(Assertion.GT, null, 2); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
106 |
expectFail(Assertion.GT, 2, null); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
107 |
} |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
108 |
|
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
109 |
private static void testNotEquals() throws Exception { |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
110 |
expectPass(Assertion.NE, null, 1); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
111 |
expectPass(Assertion.NE, 1, null); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
112 |
|
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
113 |
Foo f1 = new Foo(1); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
114 |
Foo f2 = new Foo(1); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
115 |
expectPass(Assertion.NE, f1, f2); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
116 |
|
30902 | 117 |
expectFail(Assertion.NE, (Integer)null, (Integer)null); |
21662
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
118 |
expectFail(Assertion.NE, f1, f1); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
119 |
expectFail(Assertion.NE, 1, 1); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
120 |
} |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
121 |
|
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
122 |
private static void testNull() throws Exception { |
30902 | 123 |
expectPass(Assertion.NULL, (Integer)null); |
21662
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
124 |
|
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
125 |
expectFail(Assertion.NULL, 1); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
126 |
} |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
127 |
|
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
128 |
private static void testNotNull() throws Exception { |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
129 |
expectPass(Assertion.NOTNULL, 1); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
130 |
|
30902 | 131 |
expectFail(Assertion.NOTNULL, (Integer)null); |
21662
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
132 |
} |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
133 |
|
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
134 |
private static void testTrue() throws Exception { |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
135 |
expectPass(Assertion.TRUE, true); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
136 |
|
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
137 |
expectFail(Assertion.TRUE, false); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
138 |
} |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
139 |
|
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
140 |
private static void testFalse() throws Exception { |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
141 |
expectPass(Assertion.FALSE, false); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
142 |
|
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
143 |
expectFail(Assertion.FALSE, true); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
144 |
} |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
145 |
|
23036
b711f9772be8
8035889: jdk testlibrary - add printing of values of failed assertions
rriggs
parents:
21662
diff
changeset
|
146 |
private static void testFail() throws Exception { |
b711f9772be8
8035889: jdk testlibrary - add printing of values of failed assertions
rriggs
parents:
21662
diff
changeset
|
147 |
try { |
b711f9772be8
8035889: jdk testlibrary - add printing of values of failed assertions
rriggs
parents:
21662
diff
changeset
|
148 |
fail(); |
b711f9772be8
8035889: jdk testlibrary - add printing of values of failed assertions
rriggs
parents:
21662
diff
changeset
|
149 |
} catch (RuntimeException re) { |
b711f9772be8
8035889: jdk testlibrary - add printing of values of failed assertions
rriggs
parents:
21662
diff
changeset
|
150 |
assertEquals("fail", re.getMessage()); |
b711f9772be8
8035889: jdk testlibrary - add printing of values of failed assertions
rriggs
parents:
21662
diff
changeset
|
151 |
} |
b711f9772be8
8035889: jdk testlibrary - add printing of values of failed assertions
rriggs
parents:
21662
diff
changeset
|
152 |
|
b711f9772be8
8035889: jdk testlibrary - add printing of values of failed assertions
rriggs
parents:
21662
diff
changeset
|
153 |
try { |
b711f9772be8
8035889: jdk testlibrary - add printing of values of failed assertions
rriggs
parents:
21662
diff
changeset
|
154 |
fail("Failure"); |
b711f9772be8
8035889: jdk testlibrary - add printing of values of failed assertions
rriggs
parents:
21662
diff
changeset
|
155 |
} catch (RuntimeException re) { |
b711f9772be8
8035889: jdk testlibrary - add printing of values of failed assertions
rriggs
parents:
21662
diff
changeset
|
156 |
assertEquals("Failure", re.getMessage()); |
b711f9772be8
8035889: jdk testlibrary - add printing of values of failed assertions
rriggs
parents:
21662
diff
changeset
|
157 |
} |
b711f9772be8
8035889: jdk testlibrary - add printing of values of failed assertions
rriggs
parents:
21662
diff
changeset
|
158 |
|
b711f9772be8
8035889: jdk testlibrary - add printing of values of failed assertions
rriggs
parents:
21662
diff
changeset
|
159 |
Exception e = new Exception("the cause"); |
b711f9772be8
8035889: jdk testlibrary - add printing of values of failed assertions
rriggs
parents:
21662
diff
changeset
|
160 |
try { |
b711f9772be8
8035889: jdk testlibrary - add printing of values of failed assertions
rriggs
parents:
21662
diff
changeset
|
161 |
fail("Fail w/ cause", e); |
b711f9772be8
8035889: jdk testlibrary - add printing of values of failed assertions
rriggs
parents:
21662
diff
changeset
|
162 |
} catch (RuntimeException re) { |
b711f9772be8
8035889: jdk testlibrary - add printing of values of failed assertions
rriggs
parents:
21662
diff
changeset
|
163 |
assertEquals("Fail w/ cause", re.getMessage()); |
b711f9772be8
8035889: jdk testlibrary - add printing of values of failed assertions
rriggs
parents:
21662
diff
changeset
|
164 |
assertEquals(e, re.getCause(), "Cause mismatch"); |
b711f9772be8
8035889: jdk testlibrary - add printing of values of failed assertions
rriggs
parents:
21662
diff
changeset
|
165 |
} |
b711f9772be8
8035889: jdk testlibrary - add printing of values of failed assertions
rriggs
parents:
21662
diff
changeset
|
166 |
|
b711f9772be8
8035889: jdk testlibrary - add printing of values of failed assertions
rriggs
parents:
21662
diff
changeset
|
167 |
try { |
b711f9772be8
8035889: jdk testlibrary - add printing of values of failed assertions
rriggs
parents:
21662
diff
changeset
|
168 |
fail(1, 2, "Different", "vs"); |
b711f9772be8
8035889: jdk testlibrary - add printing of values of failed assertions
rriggs
parents:
21662
diff
changeset
|
169 |
} catch (RuntimeException re) { |
b711f9772be8
8035889: jdk testlibrary - add printing of values of failed assertions
rriggs
parents:
21662
diff
changeset
|
170 |
assertEquals("Different <1> vs <2>", re.getMessage()); |
b711f9772be8
8035889: jdk testlibrary - add printing of values of failed assertions
rriggs
parents:
21662
diff
changeset
|
171 |
} |
b711f9772be8
8035889: jdk testlibrary - add printing of values of failed assertions
rriggs
parents:
21662
diff
changeset
|
172 |
} |
b711f9772be8
8035889: jdk testlibrary - add printing of values of failed assertions
rriggs
parents:
21662
diff
changeset
|
173 |
|
30902 | 174 |
@SuppressWarnings("unchecked") |
21662
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
175 |
private static <T extends Comparable<T>> void expectPass(Assertion assertion, T ... args) |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
176 |
throws Exception { |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
177 |
Assertion.run(assertion, args); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
178 |
} |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
179 |
|
30902 | 180 |
@SuppressWarnings("unchecked") |
21662
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
181 |
private static <T extends Comparable<T>> void expectFail(Assertion assertion, T ... args) |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
182 |
throws Exception { |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
183 |
try { |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
184 |
Assertion.run(assertion, args); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
185 |
} catch (RuntimeException e) { |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
186 |
return; |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
187 |
} |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
188 |
throw new Exception("Expected " + Assertion.format(assertion, (Object[]) args) + |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
189 |
" to throw a RuntimeException"); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
190 |
} |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
191 |
|
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
192 |
} |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
193 |
|
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
194 |
enum Assertion { |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
195 |
LT, LTE, EQ, GTE, GT, NE, NULL, NOTNULL, FALSE, TRUE; |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
196 |
|
30902 | 197 |
@SuppressWarnings("unchecked") |
21662
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
198 |
public static <T extends Comparable<T>> void run(Assertion assertion, T ... args) { |
30902 | 199 |
String msg = "Expected " + format(assertion, (Object[])args) + " to pass"; |
21662
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
200 |
switch (assertion) { |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
201 |
case LT: |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
202 |
assertLessThan(args[0], args[1], msg); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
203 |
break; |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
204 |
case LTE: |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
205 |
assertLessThanOrEqual(args[0], args[1], msg); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
206 |
break; |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
207 |
case EQ: |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
208 |
assertEquals(args[0], args[1], msg); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
209 |
break; |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
210 |
case GTE: |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
211 |
assertGreaterThanOrEqual(args[0], args[1], msg); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
212 |
break; |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
213 |
case GT: |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
214 |
assertGreaterThan(args[0], args[1], msg); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
215 |
break; |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
216 |
case NE: |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
217 |
assertNotEquals(args[0], args[1], msg); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
218 |
break; |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
219 |
case NULL: |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
220 |
assertNull(args == null ? args : args[0], msg); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
221 |
break; |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
222 |
case NOTNULL: |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
223 |
assertNotNull(args == null ? args : args[0], msg); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
224 |
break; |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
225 |
case FALSE: |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
226 |
assertFalse((Boolean) args[0], msg); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
227 |
break; |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
228 |
case TRUE: |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
229 |
assertTrue((Boolean) args[0], msg); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
230 |
break; |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
231 |
default: |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
232 |
// do nothing |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
233 |
} |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
234 |
} |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
235 |
|
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
236 |
public static String format(Assertion assertion, Object ... args) { |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
237 |
switch (assertion) { |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
238 |
case LT: |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
239 |
return asString("assertLessThan", args); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
240 |
case LTE: |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
241 |
return asString("assertLessThanOrEqual", args); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
242 |
case EQ: |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
243 |
return asString("assertEquals", args); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
244 |
case GTE: |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
245 |
return asString("assertGreaterThanOrEquals", args); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
246 |
case GT: |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
247 |
return asString("assertGreaterThan", args); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
248 |
case NE: |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
249 |
return asString("assertNotEquals", args); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
250 |
case NULL: |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
251 |
return asString("assertNull", args); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
252 |
case NOTNULL: |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
253 |
return asString("assertNotNull", args); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
254 |
case FALSE: |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
255 |
return asString("assertFalse", args); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
256 |
case TRUE: |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
257 |
return asString("assertTrue", args); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
258 |
default: |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
259 |
return ""; |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
260 |
} |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
261 |
} |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
262 |
|
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
263 |
private static String asString(String assertion, Object ... args) { |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
264 |
if (args == null) { |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
265 |
return String.format("%s(null)", assertion); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
266 |
} |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
267 |
if (args.length == 1) { |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
268 |
return String.format("%s(%s)", assertion, args[0]); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
269 |
} else { |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
270 |
return String.format("%s(%s, %s)", assertion, args[0], args[1]); |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
271 |
} |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
272 |
} |
b37eb0c9db8d
8015497: Take new fixes from hotspot/test/testlibrary to jdk/test/lib/testlibrary
ykantser
parents:
diff
changeset
|
273 |
} |