⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ozonetestresult.java

📁 用Java写的面相对象的数据库管理系统
💻 JAVA
字号:
// You can redistribute this software and/or modify it under the terms of// the Ozone Library License version 1 published by ozone-db.org.//// The original code and portions created by SMB are// Copyright (C) 1997-2000 by SMB GmbH. All rights reserved.//// $Id: OzoneTestResult.java,v 1.3 2000/10/28 16:55:19 daniela Exp $package org.ozoneDB.test;import java.io.*;import java.util.*;import org.ozoneDB.*;import test.framework.*;/** * @author <a href="http://www.softwarebuero.de/">SMB</a> * @version $Revision: 1.3 $Date: 2000/10/28 16:55:19 $ */public class OzoneTestResult extends TestResult {            public synchronized void addError( Test test, Throwable t ) {        super.addError( test, t );        System.out.print( " Error." );    }             public synchronized void addFailure( Test test, Throwable t ) {        super.addFailure( test, t );        System.out.print( " Failure." );    }             public synchronized void startTest( Test test ) {        System.out.print( "Starting " + test.getClass().getName() + "." + ((TestCase)test).name() + "..." );        super.startTest( test );    }             public synchronized void endTest( Test test ) {        super.endTest( test );        System.out.println( " Ready." );    }             public void printErrors() {        if (testErrors() != 0) {            if (testErrors() == 1) {                System.out.println( "There was " + testErrors() + " error:" );            } else {                System.out.println( "There were " + testErrors() + " errors:" );            }                         int i = 1;            for (Enumeration e = errors(); e.hasMoreElements(); i++) {                TestFailure failure = (TestFailure)e.nextElement();                System.out.println( i + ") " + failure.failedTest() );                failure.thrownException().printStackTrace();            }         }     }             public void printFailures() {        if (testFailures() != 0) {            if (testFailures() == 1) {                System.out.println( "There was " + testFailures() + " failure:" );            } else {                System.out.println( "There were " + testFailures() + " failures:" );            }                         int i = 1;            for (Enumeration e = failures(); e.hasMoreElements(); i++) {                TestFailure failure = (TestFailure)e.nextElement();                System.out.print( i + ") " + failure.failedTest() );                Throwable t = failure.thrownException();                if (t.getMessage() != null) {                    System.out.println( " \"" + t.getMessage() + "\"" );                } else {                    System.out.println();                    failure.thrownException().printStackTrace();                }             }         }     }             public synchronized void print() {        printHeader();        printErrors();        printFailures();    }             public void printHeader() {        if (wasSuccessful()) {            System.out.println();            System.out.print( "OK" );            System.out.println( " (" + runTests() + " tests)" );        } else {                        System.out.println();            System.out.println( "!!!FAILURES!!!" );            System.out.println( "Test Results:" );            System.out.println( "Run: " + runTests() + " Failures: " + testFailures() + " Errors: " + testErrors() );        }     }     }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -