Complete the code to name the test method following JUnit conventions.
public class CalculatorTest { @Test public void [1]() { // test code here } }
The method name testAddition clearly indicates it is a test for addition, following common JUnit naming conventions.
Complete the test method name to describe the expected behavior.
public class UserServiceTest { @Test public void [1]() { // test code here } }
The method name testUserCreationFailsWhenNameIsNull clearly describes the expected behavior and condition being tested.
Fix the error in the test method name to follow JUnit naming conventions.
public class OrderServiceTest { @Test public void [1]() { // test code here } }
The method name testProcessOrderSuccessfully follows the convention of starting with 'test' and describes the expected successful process.
Fill both blanks to complete a descriptive test method name and annotation.
public class PaymentTest { [1] public void [2]() { // test code here } }
The annotation @Test marks the method as a test, and the method name testPaymentFailsWithInsufficientFunds clearly describes the test purpose.
Fill all three blanks to write a proper JUnit test method with annotation and descriptive name.
public class LoginTest { [1] public void [2]() { // Arrange User user = new User("admin", "password"); // Act boolean result = authService.login(user); // Assert assertTrue([3]); } }
The @Test annotation marks the method as a test. The method name testLoginSucceedsWithValidCredentials describes the test. The assertion assertTrue(result) checks the login result is true.