You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AssertInMethod.java 586B

12345678910111213141516171819202122
  1. import org.aspectj.testing.Tester;
  2. /** @testcase PUREJAVA compiling asserts using 1.3 (requires ajc run under JDK 1.3) */
  3. public class AssertInMethod {
  4. public static void main (String[] args) {
  5. AssertInMethod.class.getClassLoader().setClassAssertionStatus("C", true);
  6. boolean result = false;
  7. try {
  8. new C().internalMethod(null);
  9. } catch (AssertionError e) {
  10. result = true;
  11. }
  12. Tester.check(result, "assert not thrown");
  13. }
  14. }
  15. class C {
  16. void internalMethod( Object o) {
  17. assert o != null ;
  18. }
  19. }