examplejunit4test.java

来自「这个工具用于对JAVA的类文件进行覆盖率的测试」· Java 代码 · 共 31 行

JAVA
31
字号
package org.hanselexample;import org.junit.Test;import static org.junit.Assert.*;/** * Coverage Test for the Example class. * This test covers all lines (including private/anonymous classes) * of the Example class. * * @author Niklas Mehner */public class ExampleJUnit4Test {         @Test public void absTest() {        Example example = new Example();        assertEquals("abs(1) should be 1.", 1, example.abs(1));        assertEquals("abs(-1) should be 1.", 1, example.abs(-1));        assertEquals("abs(0) should be 0.", 0, example.abs(0));      }     /**     * Test the Example.add() method. This also covers the code of the inner     * class.     */    @Test public void innerClassTest() {        Example example = new Example();          assertEquals("add(2, 3) should be 5.", 5, example.add(2, 3));    }    }

⌨️ 快捷键说明

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