jdk/test/sun/nio/cs/FindOneCharEncoderBugs.java
changeset 24692 268fbc344d53
parent 5506 202f599c92aa
equal deleted inserted replaced
24691:f96e172a6ce8 24692:268fbc344d53
     1 /*
     1 /*
     2  * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   153         else fail(x + " not equal to " + y);}
   153         else fail(x + " not equal to " + y);}
   154     public static void main(String[] args) throws Throwable {
   154     public static void main(String[] args) throws Throwable {
   155         try {realMain(args);} catch (Throwable t) {unexpected(t);}
   155         try {realMain(args);} catch (Throwable t) {unexpected(t);}
   156         System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
   156         System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
   157         if (failed > 0) throw new AssertionError("Some tests failed");}
   157         if (failed > 0) throw new AssertionError("Some tests failed");}
   158     private static abstract class Fun {abstract void f() throws Throwable;}
       
   159     static void THROWS(Class<? extends Throwable> k, Fun... fs) {
       
   160         for (Fun f : fs)
       
   161             try { f.f(); fail("Expected " + k.getName() + " not thrown"); }
       
   162             catch (Throwable t) {
       
   163                 if (k.isAssignableFrom(t.getClass())) pass();
       
   164                 else unexpected(t);}}
       
   165     private static abstract class CheckedThread extends Thread {
   158     private static abstract class CheckedThread extends Thread {
   166         abstract void realRun() throws Throwable;
   159         abstract void realRun() throws Throwable;
   167         public void run() {
   160         public void run() {
   168             try {realRun();} catch (Throwable t) {unexpected(t);}}}
   161             try {realRun();} catch (Throwable t) {unexpected(t);}}}
   169 }
   162 }