Challenge - 5 Problems
IDE Integration Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
JUnit Test Execution Result in IntelliJ
Given the following JUnit 5 test class, what will be the test execution result shown in IntelliJ's test runner after running this test?
JUnit
import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; public class CalculatorTest { @Test void testAddition() { int result = 2 + 3; assertEquals(5, result); } }
Attempts:
2 left
💡 Hint
Think about what the assertion is checking and the actual calculation.
✗ Incorrect
The test adds 2 + 3 which equals 5, matching the expected value in assertEquals. Therefore, the test passes and IntelliJ shows a green checkmark with '1 test successful'.
❓ assertion
intermediate2:00remaining
Correct Assertion for Null Check in Eclipse JUnit
In Eclipse, you want to write a JUnit 5 test to verify that a method returns null. Which assertion is correct to use?
JUnit
import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; public class UserServiceTest { @Test void testGetUserReturnsNull() { UserService service = new UserService(); User user = service.getUser("unknown"); // Which assertion to use here? } }
Attempts:
2 left
💡 Hint
JUnit provides a specific assertion method for null checks.
✗ Incorrect
assertNull(user) is the recommended JUnit assertion to check if an object is null. It provides clearer test reports in Eclipse and IntelliJ.
🔧 Debug
advanced2:00remaining
Debugging a Failing JUnit Test in IntelliJ
You run a JUnit test in IntelliJ and it fails with an AssertionError. You want to debug the test to find the problem. Which step is NOT part of the correct debugging process in IntelliJ?
Attempts:
2 left
💡 Hint
Debugging requires pausing execution to inspect state.
✗ Incorrect
Using the 'Run' button executes the test normally without pausing, so you cannot inspect variables or step through code. Debug mode with breakpoints is needed.
❓ framework
advanced2:00remaining
Configuring JUnit 5 in Eclipse for Maven Project
You have a Maven project in Eclipse and want to use JUnit 5 for testing. Which configuration step is essential to run JUnit 5 tests successfully in Eclipse?
Attempts:
2 left
💡 Hint
Maven manages dependencies via pom.xml.
✗ Incorrect
JUnit 5 requires adding its dependency in pom.xml so Maven downloads it and Eclipse can run the tests. JUnit 4 dependency alone won't run JUnit 5 tests.
🧠 Conceptual
expert3:00remaining
Understanding Test Reports in IntelliJ for Parameterized Tests
You run a parameterized JUnit 5 test in IntelliJ with 3 different input sets. How does IntelliJ display the test results in the test runner panel?
JUnit
import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; import static org.junit.jupiter.api.Assertions.*; public class MathTest { @ParameterizedTest @ValueSource(ints = {1, 2, 3}) void testIsPositive(int number) { assertTrue(number > 0); } }
Attempts:
2 left
💡 Hint
IntelliJ groups parameterized tests under one test name with sub-tests.
✗ Incorrect
IntelliJ displays parameterized tests as one test with expandable sub-tests for each input, showing pass/fail status individually.