I see there was introduced the new JUnit Jupiter according to JUnit 5 User Guide.
JUnit 5 = JUnit Platform + JUnit Jupiter + JUnit Vintage
I am confused about the same-named annotations I use across the library. Is there any significant difference between these two ones?
org.junit.Test
org.junit.jupiter.api.Test
The description from the linked page above explains the annotation org.junit.jupiter.api.Test
as following:
Denotes that a method is a test method. Unlike JUnit 4’s @Test annotation, this annotation does not declare any attributes, since test extensions in JUnit Jupiter operate based on their own dedicated annotations. Such methods are inherited unless they are overridden.
As far as I understand, the main difference is the new annotation attributes are replaced with the dedicated annotations and methods (ex. assertTimeout(...)
) unlike the old @Test(timeout = 1000)
.
The documentation speaks about the old annotation org.junit.Test
from the JUnit 4, however, doesn't clearly explain the purpose of the same annotation in the version JUnit 5, which is for my surprise not marked as @Deprecated
- it means there is still a purpose of using this annotation within JUnit 5, am I right?
My question is what is the purpose of org.junit.Test
in JUnit 5, why it's not deprecated and what my choice should be based on between the two annotations mentioned above.