Complete the code to declare a test method in JUnit 5.
@[1] public void testAddition() { int sum = 2 + 3; assertEquals(5, sum); }
The @Test annotation marks a method as a test method in JUnit 5.
Complete the code to assert that two strings are equal in a JUnit test.
assert[1]("hello", greeting);
The assertEquals method checks if two values are equal in JUnit tests.
Fix the error in the test method declaration by completing the annotation.
@org.junit.jupiter.api.[1] void checkValue() { assertTrue(value > 0); }
The correct annotation to mark a test method is @Test from JUnit Jupiter API.
Fill both blanks to create a test method that checks if a list is empty.
@[1] public void testListEmpty() { List<String> list = new ArrayList<>(); assert[2](list.isEmpty()); }
The method must be annotated with @Test and use assertTrue to check if the list is empty.
Fill all three blanks to write a test that verifies a string contains a substring.
@[1] public void testContains() { String text = "JUnit testing"; assert[2](text.[3]("test")); }
The test method uses @Test annotation, asserts true for the condition, and calls contains on the string.