MINI SHELL

Server : Apache/2.2.2 (Fedora)
System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686
User : apache ( 48)
PHP Version : 5.2.9
Disable Function : NONE
Directory :  /proc/self/root/usr/share/junit/tests/extensions/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/self/root/usr/share/junit/tests/extensions/ExceptionTestCaseTest.java
package junit.tests.extensions;

import junit.framework.*;
import junit.extensions.*;

public class ExceptionTestCaseTest extends junit.framework.TestCase {

	static public class ThrowExceptionTestCase extends ExceptionTestCase {
		public ThrowExceptionTestCase(String name, Class exception) {
			super(name, exception);
		}
		public void test() {
			throw new IndexOutOfBoundsException();
		}
	}

	static public class ThrowRuntimeExceptionTestCase extends ExceptionTestCase {
		public ThrowRuntimeExceptionTestCase(String name, Class exception) {
			super(name, exception);
		}
		public void test() {
			throw new RuntimeException();
		}
	}

	static public class ThrowNoExceptionTestCase extends ExceptionTestCase {
		public ThrowNoExceptionTestCase(String name, Class exception) {
			super(name, exception);
		}
		public void test() {
		}
	}

	public void testExceptionSubclass() {
		ExceptionTestCase test= new ThrowExceptionTestCase("test", IndexOutOfBoundsException.class);
		TestResult result= test.run();
		assertEquals(1, result.runCount());
		assertTrue(result.wasSuccessful());
	}
	public void testExceptionTest() {
		ExceptionTestCase test= new ThrowExceptionTestCase("test", IndexOutOfBoundsException.class);
		TestResult result= test.run();
		assertEquals(1, result.runCount());
		assertTrue(result.wasSuccessful());
	}
	public void testFailure() {
		ExceptionTestCase test= new ThrowRuntimeExceptionTestCase("test", IndexOutOfBoundsException.class);
		TestResult result= test.run();
		assertEquals(1, result.runCount());
		assertEquals(1, result.errorCount());
	}
	public void testNoException() {
		ExceptionTestCase test= new ThrowNoExceptionTestCase("test", Exception.class);
		TestResult result= test.run();
		assertEquals(1, result.runCount());
		assertEquals(1, result.failureCount());
	}
	public void testWrongException() {
		ExceptionTestCase test= new ThrowRuntimeExceptionTestCase("test", IndexOutOfBoundsException.class);
		TestResult result= test.run();
		assertEquals(1, result.runCount());
		assertEquals(1, result.errorCount());
	}
}

Anon7 - 2021