We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
org.junit.rules.ExpectedException appears in a few places in Design Partner 1's code base.
org.junit.rules.ExpectedException
Per its documentation, ExpectedException is used like this:
ExpectedException
package org.openrewrite.java.testing.junit5; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; public class SimpleExpectedExceptionTest { @Rule public ExpectedException thrown = ExpectedException.none(); @Test public void throwsNothing() { // no exception expected, none thrown: passes. } @Test public void throwsExceptionWithSpecificType() { thrown.expect(NullPointerException.class); throw new NullPointerException(); } }
One way of translating this to JUnit 5 is:
package org.openrewrite.java.testing.junit5; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertThrows; public class SimpleExpectedExceptionTest { @Test public void throwsNothing() { // no exception expected, none thrown: passes. } @Test public void throwsExceptionWithSpecificType() { assertThrows(NullPointerException.class, () -> { throw new NullPointerException(); }); } }
The text was updated successfully, but these errors were encountered:
5abf325
sambsnyd
No branches or pull requests
org.junit.rules.ExpectedException
appears in a few places in Design Partner 1's code base.Per its documentation,
ExpectedException
is used like this:One way of translating this to JUnit 5 is:
The text was updated successfully, but these errors were encountered: