dispatchvaliddispatchtest.java

来自「Very Nice library for using ActiveX cont」· Java 代码 · 共 42 行

JAVA
42
字号
package com.jacob.com;

import com.jacob.test.BaseTestCase;

/**
 * Test armoring of dispatch static methods
 * <p>
 * May need to run with some command line options (including from inside
 * Eclipse). Look in the docs area at the Jacob usage document for command line
 * options.
 */
public class DispatchValidDispatchTest extends BaseTestCase {

	/**
	 * force an IllegalArgumentException to verify the utility method throws
	 * correctly.
	 */
	public void testThrowIllegalArgumentException() {
		try {
			Dispatch.call(null, 0);
			fail("Failed to throw IllegalArgumentException");
		} catch (IllegalArgumentException iae) {
			System.out.println("Caught correct IllegalArgumentException: "
					+ iae);
		}
	}

	/**
	 * force an IllegalStateException to verify the utility method throws
	 * correctly.
	 */
	public void testThrowIllegalStateException() {
		try {
			Dispatch foo = new Dispatch();
			Dispatch.call(foo, 0);
			fail("Failed to throw IllegalStateException");
		} catch (IllegalStateException ise) {
			System.out.println("Caught correct IllegalStateException " + ise);
		}
	}
}

⌨️ 快捷键说明

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