OnJava8-Examples/annotations/AtUnitExample1.java

39 lines
1.0 KiB
Java
Raw Normal View History

2015-09-07 11:44:36 -06:00
// annotations/AtUnitExample1.java
2015-06-15 17:47:35 -07:00
package annotations;
import com.mindviewinc.atunit.*;
import onjava.*;
2015-06-15 17:47:35 -07:00
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");
}
2015-09-07 11:44:36 -06:00
}
/* Output:
2015-06-15 17:47:35 -07:00
annotations.AtUnitExample1
. anotherDisappointment (failed)
. failureTest (failed)
. methodOneTest
. m2 This is methodTwo
. m3
(5 tests)
>>> 2 FAILURES <<<
annotations.AtUnitExample1: anotherDisappointment
annotations.AtUnitExample1: failureTest
2015-09-07 11:44:36 -06:00
*/