Fix dispose tests for JRuby