I'm having trouble making assert_raise
recognize java exceptions.
I can do
assert_raise(NativeException) { @iter.next }
which works fine, but if I try to get more specific
java_import 'java.util.NoSuchElementException'
#...
assert_raise(NoSuchElementException) { @iter.next }
I get the error
Should expect a class of exception, Java::JavaUtil::NoSuchElementException.
<nil> is not true.
However, I can use begin/rescue/end
to catch the exception:
assert(begin
@iter.next
false
rescue NoSuchElementException
true
end)
Is there something I'm doing wrong, or is this a failure on Test::Unit
's part?