B. Method parameter type should be int, not String
C. ValueSource should use strings instead of ints
D. assertTrue cannot be used in parameterized tests
Solution
Step 1: Check parameter type vs ValueSource
@ValueSource provides ints, but method parameter is String, causing type mismatch.
Step 2: Correct parameter type
Change method parameter to int to match input type and avoid parsing.
Final Answer:
Method parameter type should be int, not String -> Option B
Quick Check:
Parameter type must match @ValueSource type [OK]
Hint: Match method parameter type with @ValueSource data type [OK]
Common Mistakes:
Using wrong parameter type
Forgetting @ParameterizedTest annotation
Misusing assertTrue in parameterized tests
5. You want to test a method that checks if a number is even using @ParameterizedTest with multiple inputs including 0, -2, and 3. Which of the following test method signatures and annotations correctly achieve this?