Test for %javaexception classes being added to a method's throws clause

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6003 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2004-06-27 21:07:15 +00:00
commit 24f91357f2
2 changed files with 93 additions and 1 deletions

View file

@ -55,6 +55,39 @@ public class java_throws_runme {
if (!pass)
throw new RuntimeException("Test 4 failed");
// Check except feature throws attribute...
// Static method
pass = false;
try {
FeatureTest.staticMethod();
}
catch (MyException e) { pass = true; }
if (!pass)
throw new RuntimeException("Test 5 failed");
FeatureTest f = new FeatureTest();
// Instance method
pass = false;
try {
f.method();
}
catch (MyException e) { pass = true; }
if (!pass)
throw new RuntimeException("Test 6 failed");
// Global function
pass = false;
try {
java_throws.globalFunction(10);
}
catch (MyException e) { pass = true; }
catch (ClassNotFoundException e) {}
catch (NoSuchFieldException e) {}
if (!pass)
throw new RuntimeException("Test 7 failed");
}
}