Skip to content

Conversation

@pbodnar
Copy link
Contributor

@pbodnar pbodnar commented Jun 10, 2023

Overview

I believe that the expected property is widely used in JUnit 4, so it would deserve a note in the migration guide.


I hereby agree to the terms of the JUnit Contributor License Agreement.

@sbrannen
Copy link
Member

The same can be said about the ExpectedException rule.

@marcphilipp
Copy link
Member

@pbodnar Could you please add that as well?

@pbodnar
Copy link
Contributor Author

pbodnar commented Jun 12, 2023

OK, I'm only not sure how to incorporate it with regards to the point about rules above and the chapter linked from there.

Maybe st like the following?

* `@Rule` and `@ClassRule` no longer exist; superseded by `@ExtendWith` and
  `@RegisterExtension`.
  - See also <<migrating-from-junit4-rule-support>>.
-* `@Test.expected` no longer exists; use `assertThrows` method instead.
+* `@Test.expected` and `ExpectedException` no longer exist; use `assertThrows` method instead.
+  See <<migrating-from-junit4-rule-support>> if you still do need to use `ExpectedException`.

@sbrannen
Copy link
Member

OK, I'm only not sure how to incorporate it with regards to the point about rules above and the chapter linked from there.

Maybe st like the following?

Seems good to me.

How about this?

@Test(expected = ...) and the ExpectedException rule no longer exist; use Assertions.assertThrows(...) instead.

@pbodnar
Copy link
Contributor Author

pbodnar commented Jun 13, 2023

OK, so here we go? :)

@pbodnar
Copy link
Contributor Author

pbodnar commented Jul 2, 2023

@sbrannen, @marcphilipp, can you see some gotcha, or ...? :)

@sbrannen sbrannen changed the title Document replacement for @Test.expected in JUnit 4 migration tips Document replacement for @Test(expected = ...) in JUnit 4 migration tips Jul 3, 2023
@sbrannen sbrannen self-assigned this Jul 3, 2023
@sbrannen sbrannen added this to the 5.10 RC1 milestone Jul 3, 2023
@sbrannen
Copy link
Member

sbrannen commented Jul 3, 2023

@sbrannen, @marcphilipp, can you see some gotcha, or ...? :)

I think that looks good now.

I'll get this merged into main before 5.10 RC1 gets released.

@sbrannen sbrannen closed this in f82d93f Jul 3, 2023
sbrannen added a commit that referenced this pull request Jul 3, 2023
@sbrannen
Copy link
Member

sbrannen commented Jul 3, 2023

This has been merged into main.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants