0
0
JUnittesting~10 mins

Maven dependency setup in JUnit - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to add the JUnit 5 dependency groupId in the Maven POM file.

JUnit
<dependency>
  <groupId>[1]</groupId>
  <artifactId>junit-jupiter</artifactId>
  <version>5.9.3</version>
  <scope>test</scope>
</dependency>
Drag options to blanks, or click blank then click option'
Aorg.junit
Bjunit
Corg.junit.jupiter
Dorg.junit.jupiter.api
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'org.junit.jupiter.api' which is a package name, not a groupId.
Using 'junit' which is for JUnit 4, not JUnit 5.
2fill in blank
medium

Complete the code to specify the artifactId for JUnit 5 Jupiter engine in the Maven POM file.

JUnit
<dependency>
  <groupId>org.junit.jupiter</groupId>
  <artifactId>[1]</artifactId>
  <version>5.9.3</version>
  <scope>test</scope>
</dependency>
Drag options to blanks, or click blank then click option'
Ajunit-vintage-engine
Bjunit-jupiter-engine
Cjunit-platform-engine
Djunit-jupiter
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'junit-jupiter-engine' which only includes the engine, not the API.
Using 'junit-vintage-engine' which is for running JUnit 4 tests.
3fill in blank
hard

Fix the error in the version tag to use the latest stable JUnit 5 version.

JUnit
<dependency>
  <groupId>org.junit.jupiter</groupId>
  <artifactId>junit-jupiter</artifactId>
  <version>[1]</version>
  <scope>test</scope>
</dependency>
Drag options to blanks, or click blank then click option'
A5.9.3
B5.7.0
C4.13.2
D6.0.0
Attempts:
3 left
💡 Hint
Common Mistakes
Using JUnit 4 version numbers like 4.13.2.
Using a non-existent future version like 6.0.0.
4fill in blank
hard

Fill both blanks to add the Maven scope and the correct tag to include JUnit 5 dependency.

JUnit
<dependency>
  <groupId>org.junit</groupId>
  <artifactId>junit-jupiter</artifactId>
  <version>5.9.3</version>
  <[1]>[2]</[1]>
</dependency>
Drag options to blanks, or click blank then click option'
Ascope
Btest
Cversion
Dcompile
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'compile' scope which includes the dependency in production builds unnecessarily.
Using 'version' as a tag name instead of 'scope'.
5fill in blank
hard

Fill all three blanks to complete a Maven POM snippet that adds JUnit 5 dependency with groupId, artifactId, and version.

JUnit
<dependency>
  <groupId>[1]</groupId>
  <artifactId>[2]</artifactId>
  <version>[3]</version>
  <scope>test</scope>
</dependency>
Drag options to blanks, or click blank then click option'
Aorg.junit
Bjunit-jupiter
C5.9.3
Dorg.junit.jupiter
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing groupId and artifactId values.
Using outdated version numbers.