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

📄 testimplementortest.java

📁 Java测试工具Junit3.8.1官方发布源码
💻 JAVA
字号:
package junit.tests.framework;import junit.framework.*;/** * Test an implementor of junit.framework.Test other than TestCase or TestSuite */public class TestImplementorTest extends TestCase {	public static class DoubleTestCase implements Test {		private TestCase fTestCase;				public DoubleTestCase(TestCase testCase) {			fTestCase= testCase;		}				public int countTestCases() {			return 2;		}				public void run(TestResult result) {			result.startTest(this);			Protectable p= new Protectable() {				public void protect() throws Throwable {					fTestCase.runBare();					fTestCase.runBare();				}			};			result.runProtected(this, p);			result.endTest(this);		}	}		private DoubleTestCase fTest;		public TestImplementorTest() {		TestCase testCase= new TestCase() {			public void runTest() {			}		};		fTest= new DoubleTestCase(testCase);	}		public void testSuccessfulRun() {		TestResult result= new TestResult();		fTest.run(result);		assertEquals(fTest.countTestCases(), result.runCount());		assertEquals(0, result.errorCount());		assertEquals(0, result.failureCount());	}}

⌨️ 快捷键说明

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