testthrowexception.java

来自「著名的uncle Bob的Agile software development的」· Java 代码 · 共 42 行

JAVA
42
字号
import junit.framework.*;
import junit.swingui.TestRunner;

public class TestThrowException extends TestCase
{
  public static void main(String[] args)
  {
    TestRunner.main(new String[]{"TestThrowException"});
  }

  public TestThrowException(String name)
  {
    super(name);
  }

  public void setUp() throws Exception
  {
  }

  public void tearDown() throws Exception
  {
  }

  public void testBase() throws Exception
  {
    Base b = new Base();
    b.f();
  }

  public void testDerived() throws Exception
  {
    Base b = new Derived();
    try
    {
      b.f();
      fail();
    }
    catch (Exception e)
    {
    }
  }
}

⌨️ 快捷键说明

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