0
0
JUnittesting~10 mins

@Disabled for skipping tests 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 disable the test method using the correct annotation.

JUnit
@[1]
public void testFeature() {
    // test code here
}
Drag options to blanks, or click blank then click option'
ADisabled
BIgnore
CSkip
DTest
Attempts:
3 left
💡 Hint
Common Mistakes
Using @Ignore instead of @Disabled
Forgetting the '@' symbol
Using @Test which runs the test instead of skipping
2fill in blank
medium

Complete the code to disable the entire test class.

JUnit
@[1]
public class FeatureTests {
    @Test
    public void testOne() {}
}
Drag options to blanks, or click blank then click option'
ATest
BIgnore
CSkip
DDisabled
Attempts:
3 left
💡 Hint
Common Mistakes
Using @Test which runs tests
Using @Ignore which is from JUnit 4, not recommended in JUnit 5
Missing the '@' symbol
3fill in blank
hard

Fix the error in the code to properly disable the test method.

JUnit
@Test
@[1]
public void testFeature() {
    // test code
}
Drag options to blanks, or click blank then click option'
ADisabled
BIgnore
CSkip
DTest
Attempts:
3 left
💡 Hint
Common Mistakes
Using @Ignore instead of @Disabled
Using @Skip which is not a JUnit annotation
Using @Test twice
4fill in blank
hard

Fill both blanks to disable the test method with a reason message.

JUnit
@[1]("[2]")
public void testFeature() {
    // test code
}
Drag options to blanks, or click blank then click option'
ADisabled
BSkipped
CTest
DIgnore
Attempts:
3 left
💡 Hint
Common Mistakes
Using @Ignore with a reason (JUnit 4 style)
Using @Test instead of @Disabled
Not providing a string reason
5fill in blank
hard

Fill all three blanks to disable a test method with a reason and import the correct annotation.

JUnit
import org.junit.jupiter.api.[1];

@[2]("[3]")
public void testFeature() {
    // test code
}
Drag options to blanks, or click blank then click option'
ADisabled
BTest
CSkipped
DIgnore
Attempts:
3 left
💡 Hint
Common Mistakes
Importing @Ignore instead of @Disabled
Using @Test instead of @Disabled
Not providing the reason string