# HG changeset patch # User Paul Boddie # Date 1100022758 -3600 # Node ID eb6e8da8c28efc51bee19b378c8d9d98da2af312 # Parent bd70c69bd9aea66087a6975e5a00ef3e9f724dfc Added some test cases. diff -r bd70c69bd9ae -r eb6e8da8c28e tests/ExceptionTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/ExceptionTest.java Tue Nov 09 18:52:38 2004 +0100 @@ -0,0 +1,35 @@ +public class ExceptionTest { + + public int testCatch() { + try { + throw new MyException(); + } catch (MyException exc) { + return 1; + } + } + + public int testFinally(int x) { + try { + if (x == 0) { + throw new MyException(); + } else if (x == 1) { + throw new MyOtherException(); + } + } catch (MyException exc) { + x = 3; + } catch (MyOtherException exc) { + x = 2; + } finally { + x = 1; + } + return x; + } +} + +class MyException extends java.lang.Exception { +} + +class MyOtherException extends java.lang.Exception { +} + +// vim: tabstop=4 expandtab shiftwidth=4 diff -r bd70c69bd9ae -r eb6e8da8c28e tests/Value.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/Value.java Tue Nov 09 18:52:38 2004 +0100 @@ -0,0 +1,17 @@ +public class Value { + private int value; + + public Value(int value) { + this.value = value; + } + + public int getValue() { + return this.value; + } + + public void setValue(int value) { + this.value = value; + } +} + +// vim: tabstop=4 expandtab shiftwidth=4