Complete the code to mark the test method with JUnit 5 annotation.
import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; public class CalculatorTest { [1] void testAddition() { int sum = 2 + 3; assertEquals(5, sum); } }
Complete the code to assert that the result equals 10.
import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; @Test void testMultiplication() { int result = 2 * 5; [1](10, result); }
Fix the error in the test method to make it run correctly.
import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; @Test void testDivision() { int result = 10 / 2; assertEquals(5, [1]); }
Fill both blanks to create a fast test that runs multiple times.
import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.RepeatedTest; @RepeatedTest([1]) void testFastAddition() { int sum = 1 + 1; assertEquals([2], sum); }
Fill all three blanks to create a test that fails fast on wrong input.
import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; @Test void testFailFast() { int input = [1]; int expected = [2]; int actual = input * 2; assertEquals([3], actual); }
