Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/jdk/javax/xml/jaxp/transform/8004476/TestBase.java
41154 views
1
/*
2
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*/
23
24
import java.security.Policy;
25
26
/**
27
*
28
*
29
* @author [email protected]
30
*/
31
public class TestBase {
32
public static boolean isWindows = false;
33
static {
34
if (System.getProperty("os.name").indexOf("Windows")>-1) {
35
isWindows = true;
36
}
37
};
38
39
String filepath;
40
boolean hasSM;
41
String curDir;
42
Policy origPolicy;
43
String testName;
44
static String errMessage;
45
46
int passed = 0, failed = 0;
47
48
/**
49
* Creates a new instance of StreamReader
50
*/
51
public TestBase(String name) {
52
testName = name;
53
}
54
55
//junit @Override
56
protected void setUp() {
57
if (System.getSecurityManager() != null) {
58
hasSM = true;
59
System.setSecurityManager(null);
60
}
61
62
filepath = System.getProperty("test.src");
63
if (filepath == null) {
64
//current directory
65
filepath = System.getProperty("user.dir");
66
}
67
origPolicy = Policy.getPolicy();
68
69
}
70
71
//junit @Override
72
public void tearDown() {
73
// turn off security manager and restore policy
74
System.setSecurityManager(null);
75
Policy.setPolicy(origPolicy);
76
if (hasSM) {
77
System.setSecurityManager(new SecurityManager());
78
}
79
System.out.println("\nNumber of tests passed: " + passed);
80
System.out.println("Number of tests failed: " + failed + "\n");
81
82
if (errMessage != null ) {
83
throw new RuntimeException(errMessage);
84
}
85
}
86
87
void fail(String errMsg) {
88
if (errMessage == null) {
89
errMessage = errMsg;
90
} else {
91
errMessage = errMessage + "\n" + errMsg;
92
}
93
failed++;
94
}
95
96
void success(String msg) {
97
passed++;
98
System.out.println(msg);
99
}
100
101
}
102
103