testeventlistener.java

来自「MoMEUnit是一个单元测试的J2ME的应用程序xUnit架构实例。这是来自J」· Java 代码 · 共 84 行

JAVA
84
字号
package org.momeunit.ant.event;/** * Abstract base class that all test event listeners must extend. Developers * should implement callback methods for processing test events * {@link #startTest(TestEvent)}, {@link #addError(TestEvent)}, * {@link #addFailure(TestEvent)}, {@link #endTest(TestEvent)}. Actually * method called on every test event is {@link #onEvevnt(TestEvent)}. To * simplify development of test listeners the implementation of this method * redirects test events to respective callback methods based on type of test * events. *  * @author Sergio Morozov * @version 1.1.2 */public abstract class TestEventListener{  /**   * Processes TestEvents. Redirects them to respective callback method.   *    * @param event   *          test event to process.   * @since 1.1   */  public void onEvevnt(TestEvent event)  {    switch (event.getType())    {    case TestEvent.START_TEST:      this.startTest(event);      break;    case TestEvent.ERROR_TEST:      this.addError(event);      break;    case TestEvent.FAIL_TEST:      this.addFailure(event);      break;    case TestEvent.END_TEST:      this.endTest(event);      break;    }  }  /**   * Callback method that indicates an error while executing test.   *    * @param event   *          test event of error while executing test.   * @since 1.1   */  public abstract void addError(TestEvent event);  /**   * Callback method that indicates test failure.   *    * @param event   *          test event of test failure.   * @since 1.1   */  public abstract void addFailure(TestEvent event);  /**   * Callback method that indicates the end of test run.   *    * @param event   *          test event of end of test run.   * @since 1.1   */  public abstract void endTest(TestEvent event);  /**   * Callback method that indicates the start of test run.   *    * @param event   *          test event of start of test run.   * @since 1.1   */  public abstract void startTest(TestEvent event);}

⌨️ 快捷键说明

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