You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<rule-title>Use Descriptive Test Names</rule-title>
217
-
<rule-subtitle>Write descriptive test method names or use @DisplayName</rule-subtitle>
217
+
<rule-subtitle>Write descriptive test method names or use `@DisplayName`</rule-subtitle>
218
218
</rule-header>
219
219
<rule-description>
220
220
Test names should clearly communicate the scenario being tested and the expected outcome. Use either descriptive method names (e.g., following the `should_ExpectedBehavior_when_StateUnderTest` pattern) or JUnit 5's `@DisplayName` annotation for more natural language descriptions. This makes test reports easier to understand.
@@ -487,10 +487,10 @@ class UserServiceTestBad {
487
487
DatabaseConnection connection = new DatabaseConnection("localhost", 5432);
488
488
UserRepository userRepository = new PostgresUserRepository(connection);
489
489
UserService userService = new UserService(userRepository);
490
-
490
+
491
491
// This test depends on database availability and state
492
492
Optional<User> user = userService.findUserById("123");
493
-
493
+
494
494
// Test is slow, brittle, and doesn't isolate the unit under test
0 commit comments