Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expect_error fails for java Exceptions #964

Closed
pfistfl opened this issue Nov 8, 2019 · 2 comments
Closed

expect_error fails for java Exceptions #964

pfistfl opened this issue Nov 8, 2019 · 2 comments

Comments

@pfistfl
Copy link

@pfistfl pfistfl commented Nov 8, 2019

since version 2.3.0, tests that check for java Exceptions fail.

On 2.2.0:
remotes::install_version("testthat", "2.2.0")

library(rJava)
library(testthat)
.jinit()
.jnew("hello/world", check = TRUE)
#> Error in .jnew("hello/world", check = TRUE): java.lang.ClassNotFoundException

expect_error(.jnew("hello/world", check = TRUE))

Created on 2019-11-08 by the reprex package (v0.3.0)

On 2.3.0:
remotes::install_version("testthat", "2.3.0")

library(rJava)
library(testthat)
.jinit()
.jnew("hello/world", check = TRUE)
#> Error in .jnew("hello/world", check = TRUE): java.lang.ClassNotFoundException

expect_error(.jnew("hello/world", check = TRUE))
#> Error in ._jobjRef_dollar(x[["jobj"]], name): no field, method or inner class called 'trace'

Created on 2019-11-08 by the reprex package (v0.3.0)

I digged a little deeper, and the reason is most likely that rlang::cnd_entrace used in capture_error tries to access the $trace slot, which does prompt a java Error.

Is there another method intended to test for Exceptions?

@hadley
Copy link
Member

@hadley hadley commented Nov 8, 2019

This is a known bug and we're hoping to get a fix out next week.

@lionel-
Copy link
Member

@lionel- lionel- commented Nov 18, 2019

Fixed by #966.

@lionel- lionel- closed this as completed Nov 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants