jdk/test/tools/jar/UpdateManifest.java
author bpb
Fri, 06 Feb 2015 08:05:44 -0800
changeset 28847 5667388e3a79
parent 22261 e82547d2e78a
child 30820 0d4717a011d3
permissions -rw-r--r--
8072495: (fs) Path.relativize() gives incorrect result for empty path on Windows Summary: Correct handling of empty path in Windows version of relativize() Reviewed-by: alanb, dfuchs
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
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
 * @summary Ensure that jar ufm actually updates the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
 * existing jar file's manifest with contents of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 * manifest file.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.io.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.util.logging.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import java.util.zip.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import sun.tools.jar.Main;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
public class UpdateManifest {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
    static PrintStream out = System.out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
    static PrintStream err = System.err;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
    static boolean debug = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
22261
e82547d2e78a 8031525: Logger created in test/tools/jar/UpdateManifest.java might get gc'ed too early.
dfuchs
parents: 6883
diff changeset
    42
    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
    43
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
    public static void realMain(String[] args) throws Throwable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
        if (args.length == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
            debug = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
            File tmp = File.createTempFile("system-out-err", ".txt");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
            tmp.deleteOnExit();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
            out = new PrintStream(new FileOutputStream(tmp));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
            err = out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
            // 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
    52
            JAR_LOGGER.setLevel(Level.OFF);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
        try { testManifestExistence(); } catch (Throwable t) { unexpected(t); }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
        try { testManifestContents(); } catch (Throwable t) { unexpected(t); }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    static void testManifestExistence() throws Throwable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
        // Create a file to put in a jar file
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
        File existence = createTextFile("existence");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
        // Create a jar file, specifying a Main-Class
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
        final String jarFileName = "um-existence.jar";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
        new File(jarFileName).delete(); // remove pre-existing first!
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
        Main jartool = new Main(out, err, "jar");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
        boolean status = jartool.run(
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
            new String[] { "cfe", jarFileName, "Hello", existence.getPath() });
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
        check(status);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
        checkManifest(jarFileName, "Hello");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
        // Update that jar file by changing the Main-Class
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
        jartool = new Main(out, err, "jar");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
        status = jartool.run(
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
            new String[] { "ufe", jarFileName, "Bye" });
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
        check(status);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
        checkManifest(jarFileName, "Bye");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    static void testManifestContents() throws Throwable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
        // Create some strings we expect to find in the updated manifest
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
        final String animal =
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
            "Name: animal/marsupial";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
        final String specTitle =
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
            "Specification-Title: Wombat";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
        // Create a text file with manifest entries
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
        File manifestOrig = File.createTempFile("manifestOrig", ".txt");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
        if (!debug) manifestOrig.deleteOnExit();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        PrintWriter pw = new PrintWriter(manifestOrig);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
        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
    92
        pw.println("Created-By: 1.7.0-internal (Oracle Corporation)");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
        pw.println("");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
        pw.println(animal);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        pw.println(specTitle);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
        pw.close();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
        File hello = createTextFile("hello");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
        // Create a jar file
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
        final String jarFileName = "um-test.jar";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
        new File(jarFileName).delete(); // remove pre-existing first!
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
        Main jartool = new Main(out, err, "jar");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
        boolean status = jartool.run(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
                                new String[] {"cfm", jarFileName,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
                                    manifestOrig.getPath(), hello.getPath() });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
        check(status);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
        // Create a new manifest, to use in updating the jar file.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
        File manifestUpdate = File.createTempFile("manifestUpdate", ".txt");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
        if (!debug) manifestUpdate.deleteOnExit();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
        pw = new PrintWriter(manifestUpdate);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
        final String createdBy =
6883
bbd0cba11983 6984046: java/jar jar/pack source needs vendor rebranding changes (jdk7 only)
sherman
parents: 5813
diff changeset
   114
            "Created-By: 1.7.0-special (Oracle Corporation)";
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
        final String specVersion =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
            "Specification-Version: 1.0.0.0";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
        pw.println(createdBy); // replaces line in the original
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
        pw.println("");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
        pw.println(animal);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
        pw.println(specVersion); // addition to animal/marsupial section
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        pw.close();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        // Update jar file with manifest
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
        jartool = new Main(out, err, "jar");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
        status = jartool.run(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
            new String[] { "ufm", jarFileName, manifestUpdate.getPath() });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
        check(status);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
        // Extract jar, and verify contents of manifest file
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
        File f = new File(jarFileName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
        if (!debug) f.deleteOnExit();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
        ZipFile zf = new ZipFile(f);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
        ZipEntry ze = zf.getEntry("META-INF/MANIFEST.MF");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
        BufferedReader r = new BufferedReader(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
            new InputStreamReader(zf.getInputStream(ze)));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
        r.readLine(); // skip Manifest-Version
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
        check(r.readLine().equals(createdBy));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
        r.readLine(); // skip blank line
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
        check(r.readLine().equals(animal));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
        String s = r.readLine();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
        if (s.equals(specVersion)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
            check(r.readLine().equals(specTitle));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
        } else if (s.equals(specTitle)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
            check(r.readLine().equals(specVersion));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
            fail("did not match specVersion nor specTitle");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
        }
5813
8e455cd3e807 6962617: Testcase changes, cleanup of problem list for jdk_tools targets
ohair
parents: 5506
diff changeset
   148
        zf.close();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    // --------------------- Convenience ---------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
    static File createTextFile(String name) throws Throwable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
        // Create a text file to put in a jar file
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
        File rc = File.createTempFile(name, ".txt");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
        if (!debug) rc.deleteOnExit();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
        PrintWriter pw = new PrintWriter(rc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
        pw.println("hello, world");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
        pw.close();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
        return rc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
    static void checkManifest(String jarFileName, String mainClass)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
                throws Throwable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
        File f = new File(jarFileName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
        if (!debug) f.deleteOnExit();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
        ZipFile zf = new ZipFile(f);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
        ZipEntry ze = zf.getEntry("META-INF/MANIFEST.MF");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
        BufferedReader r = new BufferedReader(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
            new InputStreamReader(zf.getInputStream(ze)));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
        String line = r.readLine();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
        while (line != null && !(line.startsWith("Main-Class:"))) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
            line = r.readLine();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
        if (line == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
            fail("Didn't find Main-Class in manifest");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
            check(line.equals("Main-Class: " + mainClass));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
        zf.close();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
    // --------------------- Infrastructure ---------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
    static volatile int passed = 0, failed = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
    static void pass() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
        passed++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    static void fail() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
        failed++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
        Thread.dumpStack();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    static void fail(String msg) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
        System.out.println(msg);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
        fail();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
    static void unexpected(Throwable t) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
        failed++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        t.printStackTrace();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
    static void check(boolean cond) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        if (cond)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
            pass();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
        else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
            fail();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
    static void equal(Object x, Object y) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
        if ((x == null) ? (y == null) : x.equals(y))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
            pass();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
        else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
            fail(x + " not equal to " + y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
    public static void main(String[] args) throws Throwable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
            realMain(args);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
        } catch (Throwable t) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
            unexpected(t);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
        System.out.println("\nPassed = " + passed + " failed = " + failed);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
        if (failed > 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
            throw new AssertionError("Some tests failed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
}