jdk/test/tools/jar/UpdateManifest.java
author katleman
Thu, 03 Sep 2015 14:24:43 -0700
changeset 32450 f036508e86e7
parent 30820 0d4717a011d3
child 41484 834b7539ada3
permissions -rw-r--r--
Added tag jdk9-b80 for changeset 56a580f0c008
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
6883
bbd0cba11983 6984046: java/jar jar/pack source needs vendor rebranding changes (jdk7 only)
sherman
parents: 5813
diff changeset
     2
 * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
 * @test
6883
bbd0cba11983 6984046: java/jar jar/pack source needs vendor rebranding changes (jdk7 only)
sherman
parents: 5813
diff changeset
    26
 * @bug 6434207 6442687 6984046
30820
0d4717a011d3 8081347: Add @modules to jdk_core tests
mchung
parents: 22261
diff changeset
    27
 * @modules jdk.jartool/sun.tools.jar
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
 * @summary Ensure that jar ufm actually updates the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 * existing jar file's manifest with contents of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 * manifest file.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.io.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import java.util.logging.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import java.util.zip.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import sun.tools.jar.Main;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
public class UpdateManifest {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
    static PrintStream out = System.out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
    static PrintStream err = System.err;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
    static boolean debug = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
22261
e82547d2e78a 8031525: Logger created in test/tools/jar/UpdateManifest.java might get gc'ed too early.
dfuchs
parents: 6883
diff changeset
    43
    static final Logger JAR_LOGGER = Logger.getLogger("java.util.jar");
e82547d2e78a 8031525: Logger created in test/tools/jar/UpdateManifest.java might get gc'ed too early.
dfuchs
parents: 6883
diff changeset
    44
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
    public static void realMain(String[] args) throws Throwable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
        if (args.length == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
            debug = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
            File tmp = File.createTempFile("system-out-err", ".txt");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
            tmp.deleteOnExit();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
            out = new PrintStream(new FileOutputStream(tmp));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
            err = out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
            // Attributes.read() can log a message we don't care to see.
22261
e82547d2e78a 8031525: Logger created in test/tools/jar/UpdateManifest.java might get gc'ed too early.
dfuchs
parents: 6883
diff changeset
    53
            JAR_LOGGER.setLevel(Level.OFF);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
        try { testManifestExistence(); } catch (Throwable t) { unexpected(t); }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
        try { testManifestContents(); } catch (Throwable t) { unexpected(t); }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    static void testManifestExistence() throws Throwable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
        // Create a file to put in a jar file
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
        File existence = createTextFile("existence");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
        // Create a jar file, specifying a Main-Class
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
        final String jarFileName = "um-existence.jar";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
        new File(jarFileName).delete(); // remove pre-existing first!
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
        Main jartool = new Main(out, err, "jar");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
        boolean status = jartool.run(
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
            new String[] { "cfe", jarFileName, "Hello", existence.getPath() });
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
        check(status);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
        checkManifest(jarFileName, "Hello");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
        // Update that jar file by changing the Main-Class
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
        jartool = new Main(out, err, "jar");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
        status = jartool.run(
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
            new String[] { "ufe", jarFileName, "Bye" });
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
        check(status);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
        checkManifest(jarFileName, "Bye");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    static void testManifestContents() throws Throwable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
        // Create some strings we expect to find in the updated manifest
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
        final String animal =
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
            "Name: animal/marsupial";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
        final String specTitle =
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
            "Specification-Title: Wombat";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
        // Create a text file with manifest entries
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
        File manifestOrig = File.createTempFile("manifestOrig", ".txt");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        if (!debug) manifestOrig.deleteOnExit();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
        PrintWriter pw = new PrintWriter(manifestOrig);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
        pw.println("Manifest-Version: 1.0");
6883
bbd0cba11983 6984046: java/jar jar/pack source needs vendor rebranding changes (jdk7 only)
sherman
parents: 5813
diff changeset
    93
        pw.println("Created-By: 1.7.0-internal (Oracle Corporation)");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
        pw.println("");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        pw.println(animal);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
        pw.println(specTitle);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
        pw.close();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
        File hello = createTextFile("hello");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
        // Create a jar file
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
        final String jarFileName = "um-test.jar";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
        new File(jarFileName).delete(); // remove pre-existing first!
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
        Main jartool = new Main(out, err, "jar");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        boolean status = jartool.run(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
                                new String[] {"cfm", jarFileName,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
                                    manifestOrig.getPath(), hello.getPath() });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
        check(status);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
        // Create a new manifest, to use in updating the jar file.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
        File manifestUpdate = File.createTempFile("manifestUpdate", ".txt");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
        if (!debug) manifestUpdate.deleteOnExit();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
        pw = new PrintWriter(manifestUpdate);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
        final String createdBy =
6883
bbd0cba11983 6984046: java/jar jar/pack source needs vendor rebranding changes (jdk7 only)
sherman
parents: 5813
diff changeset
   115
            "Created-By: 1.7.0-special (Oracle Corporation)";
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
        final String specVersion =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
            "Specification-Version: 1.0.0.0";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
        pw.println(createdBy); // replaces line in the original
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
        pw.println("");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
        pw.println(animal);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        pw.println(specVersion); // addition to animal/marsupial section
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
        pw.close();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
        // Update jar file with manifest
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
        jartool = new Main(out, err, "jar");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
        status = jartool.run(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
            new String[] { "ufm", jarFileName, manifestUpdate.getPath() });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
        check(status);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
        // Extract jar, and verify contents of manifest file
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
        File f = new File(jarFileName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
        if (!debug) f.deleteOnExit();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
        ZipFile zf = new ZipFile(f);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
        ZipEntry ze = zf.getEntry("META-INF/MANIFEST.MF");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
        BufferedReader r = new BufferedReader(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
            new InputStreamReader(zf.getInputStream(ze)));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
        r.readLine(); // skip Manifest-Version
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
        check(r.readLine().equals(createdBy));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
        r.readLine(); // skip blank line
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
        check(r.readLine().equals(animal));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
        String s = r.readLine();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
        if (s.equals(specVersion)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
            check(r.readLine().equals(specTitle));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
        } else if (s.equals(specTitle)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
            check(r.readLine().equals(specVersion));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
            fail("did not match specVersion nor specTitle");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
        }
5813
8e455cd3e807 6962617: Testcase changes, cleanup of problem list for jdk_tools targets
ohair
parents: 5506
diff changeset
   149
        zf.close();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
    // --------------------- Convenience ---------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
    static File createTextFile(String name) throws Throwable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
        // Create a text file to put in a jar file
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
        File rc = File.createTempFile(name, ".txt");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
        if (!debug) rc.deleteOnExit();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
        PrintWriter pw = new PrintWriter(rc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
        pw.println("hello, world");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
        pw.close();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
        return rc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
    static void checkManifest(String jarFileName, String mainClass)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
                throws Throwable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
        File f = new File(jarFileName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
        if (!debug) f.deleteOnExit();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
        ZipFile zf = new ZipFile(f);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
        ZipEntry ze = zf.getEntry("META-INF/MANIFEST.MF");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
        BufferedReader r = new BufferedReader(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
            new InputStreamReader(zf.getInputStream(ze)));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
        String line = r.readLine();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
        while (line != null && !(line.startsWith("Main-Class:"))) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
            line = r.readLine();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
        if (line == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
            fail("Didn't find Main-Class in manifest");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
            check(line.equals("Main-Class: " + mainClass));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
        zf.close();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
    // --------------------- Infrastructure ---------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
    static volatile int passed = 0, failed = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
    static void pass() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
        passed++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
    static void fail() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
        failed++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
        Thread.dumpStack();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
    static void fail(String msg) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
        System.out.println(msg);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        fail();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    static void unexpected(Throwable t) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        failed++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
        t.printStackTrace();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
    static void check(boolean cond) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
        if (cond)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
            pass();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
        else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
            fail();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    static void equal(Object x, Object y) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
        if ((x == null) ? (y == null) : x.equals(y))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
            pass();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
        else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
            fail(x + " not equal to " + y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
    public static void main(String[] args) throws Throwable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
            realMain(args);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
        } catch (Throwable t) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
            unexpected(t);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
        System.out.println("\nPassed = " + passed + " failed = " + failed);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
        if (failed > 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
            throw new AssertionError("Some tests failed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
}