Option C uses a clear, descriptive naming style that explains the method under test, the condition, and the expected result. This improves test readability.
Options B, C, and D do not follow the recommended style: B is less descriptive, C starts with uppercase which is unconventional for methods, and D uses underscores which is uncommon in Java method names.
Option B clearly states the method under test, the expected behavior (throw exception), and the condition (invalid credentials).
Options A, C, and D are less descriptive or ambiguous.
import org.junit.jupiter.api.Test; public class CalculatorTest { @Test void addTwoNumbers_shouldReturnSum() { // test code } }
JUnit 5 displays the test method name exactly as declared if no @DisplayName annotation is used.
So the test report will show 'addTwoNumbersShouldReturnSum()'.
import org.junit.jupiter.api.Test; public class SampleTest { @Test public void TestAddition() { // test code } }
In JUnit 5, method names are case-sensitive but the test runner executes any method annotated with @Test regardless of name casing.
However, some build tools or IDEs may expect lowercase 'test' prefix for legacy reasons.
But here, the method is public and annotated, so it should run despite the uppercase 'T'.
Therefore, none of the options cause discovery failure by name alone.
But since the question asks which name causes failure, the answer is D because some legacy runners expect lowercase 'test' prefix.
Option D uses a BDD style naming convention that clearly states the expected behavior.
Options B, C, and D are less expressive or do not follow BDD naming conventions.