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

📄 systemexittest.java

📁 junit
💻 JAVA
字号:
package org.junit.tests.running.core;import static org.junit.Assert.assertEquals;import java.io.File;import java.io.InputStream;import org.junit.Test;// Make sure System.exit works as expected. We've had problems with this on some platforms.public class SystemExitTest {		private static final int EXIT_CODE= 5;	static public class Exit {		public static void main(String[] args) {			System.exit(EXIT_CODE);		}	}		@Test public void failureCausesExitCodeOf1() throws Exception {		String java= System.getProperty("java.home")+File.separator+"bin"+File.separator+"java";		String classPath= getClass().getClassLoader().getResource(".").getFile() + File.pathSeparator + System.getProperty("java.class.path");		String [] cmd= { java, "-cp", classPath, getClass().getName() + "$Exit"}; 		Process process= Runtime.getRuntime().exec(cmd);		InputStream input= process.getInputStream();		while((input.read()) != -1); 		assertEquals(EXIT_CODE, process.waitFor());	}}

⌨️ 快捷键说明

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