diff -r 9984d9a62bc0 -r cb637833bfb3 rt/aot-nb-test/src/main/java/org/apidesign/bck2brwsr/aot/junit/RunTest.java --- a/rt/aot-nb-test/src/main/java/org/apidesign/bck2brwsr/aot/junit/RunTest.java Sat Mar 19 13:15:11 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +0,0 @@ -/** - * Back 2 Browser Bytecode Translator - * Copyright (C) 2012-2015 Jaroslav Tulach - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. Look for COPYING file in the top folder. - * If not, see http://opensource.org/licenses/GPL-2.0. - */ -package org.apidesign.bck2brwsr.aot.junit; - -import java.io.PrintStream; -import java.io.UnsupportedEncodingException; -import junit.framework.AssertionFailedError; -import junit.framework.JUnit4TestAdapter; -import junit.framework.Test; -import junit.framework.TestListener; -import junit.framework.TestResult; -import junit.textui.ResultPrinter; - -public class RunTest extends ResultPrinter { - public static void main(String... args) throws UnsupportedEncodingException { - System.err.println(run()); - } - - public static String run() throws UnsupportedEncodingException { - TestResult tr = new TestResult(); - class L implements TestListener { - StringBuilder sb = new StringBuilder(); - - @Override - public void addError(Test test, Throwable e) { - sb.append(test.toString()).append("\n"); - } - - @Override - public void addFailure(Test test, AssertionFailedError e) { - sb.append(test.toString()).append("\n");; - } - - @Override - public void endTest(Test test) { - } - - @Override - public void startTest(Test test) { - } - } - L listener = new L(); - tr.addListener(listener); - JUnit4TestAdapter suite = new JUnit4TestAdapter(TestedTest.class); - suite.run(tr); - return listener.sb.toString(); - } - - RunTest(PrintStream writer) { - super(writer); - } -}