Complete the code to create a simple JUnit test method that checks if 5 is greater than 3.
@Test
public void testNumberComparison() {
assertTrue(5 [1] 3);
}The test checks if 5 is greater than 3 using the > operator inside assertTrue.
Complete the code to assert that the string "hello" starts with "he".
@Test
public void testStringStart() {
assertTrue("hello".[1]("he"));
}The method startsWith checks if the string begins with the given substring.
Fix the error in the assertion that checks if two integers are equal.
@Test
public void testEquality() {
[1](10, 5 + 5);
}assertEquals is used to check if two values are equal. The first argument is the expected value.
Fill both blanks to create a test that fails if the list is empty.
@Test
public void testListNotEmpty() {
List<String> items = List.of("apple", "banana");
assertFalse(items.[1]() [2] 0);
}The test checks that the list size is not equal to zero, meaning it is not empty.
Fill all three blanks to create a test that checks if a map contains a key and its value is not null.
@Test
public void testMapKeyAndValue() {
Map<String, String> map = Map.of("key1", "value1");
assertTrue(map.[1]("key1") && map.get("key1") [2] null && !map.get("key1").[3]());
}The test confirms the map has the key, the value is not null, and the value is not empty.