您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

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. }