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

📄 unicodeerrortest.java

📁 Very Nice library for using ActiveX controls directly from java without heavy knowledge of JNI, simp
💻 JAVA
字号:
package com.jacob.test.errors;

import com.jacob.test.BaseTestCase;
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.ComException;

/**
 * This test verifies patch SF 1794811 . It shows how unicode filenames throw
 * exceptions in 1.13M4 and earlier.
 * 
 * @author justme84
 * 
 */
public class UnicodeErrorTest extends BaseTestCase {

	/**
	 * verifies that messages can now have unicode in them like when the file
	 * names have unicode characters
	 */
	public void testUnicodeCharactersInErrorMessage() {
		ActiveXComponent application = new ActiveXComponent("Word.Application");
		ActiveXComponent documents = application
				.getPropertyAsComponent("Documents");
		String fileName = "abc\u0411\u0412\u0413\u0414def";
		try {
			documents.invoke("Open", fileName);
			fail("Should have thrown an exception");
		} catch (ComException e) {
			assertTrue("Error message should contain file name with unicode "
					+ "characters in it. " + e.getMessage(), e.getMessage()
					.indexOf(fileName) > 0);
		}
	}
}

⌨️ 快捷键说明

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