OnJava8-Examples/annotations/AtUnitExample1.java
Bruce Eckel 49edcc8b17 reorg
2015-06-15 17:47:35 -07:00

39 lines
1.1 KiB
Java

//: annotations/AtUnitExample1.java
// ©2015 MindView LLC: see Copyright.txt
package annotations;
import com.mindviewinc.atunit.*;
import com.mindviewinc.util.*;
public class AtUnitExample1 {
public String methodOne() {
return "This is methodOne";
}
public int methodTwo() {
System.out.println("This is methodTwo");
return 2;
}
@Test boolean methodOneTest() {
return methodOne().equals("This is methodOne");
}
@Test boolean m2() { return methodTwo() == 2; }
@Test private boolean m3() { return true; }
// Shows output for failure:
@Test boolean failureTest() { return false; }
@Test boolean anotherDisappointment() { return false; }
public static void main(String[] args) throws Exception {
OSExecute.command(
"java com.mindviewinc.atunit.AtUnit AtUnitExample1");
}
} /* Output:
annotations.AtUnitExample1
. anotherDisappointment (failed)
. failureTest (failed)
. methodOneTest
. m2 This is methodTwo
. m3
(5 tests)
>>> 2 FAILURES <<<
annotations.AtUnitExample1: anotherDisappointment
annotations.AtUnitExample1: failureTest
*///:~