Complete the code to declare a test class in the correct package.
package com.example.tests; import org.junit.jupiter.api.Test; public class [1] { @Test void sampleTest() { // test code } }
The class name should be descriptive and typically ends with 'Test'. 'SampleTest' is a common naming convention.
Complete the code to import the JUnit 5 test annotation.
package com.example.tests; import [1]; public class SampleTest { @Test void sampleTest() { // test code } }
JUnit 5 uses the package org.junit.jupiter.api for its annotations like @Test.
Fix the error in the package declaration to organize tests properly.
package [1]; import org.junit.jupiter.api.Test; public class SampleTest { @Test void sampleTest() { // test code } }
The package name should be plural 'tests' to follow common conventions for test packages.
Fill both blanks to create a package-info.java file with a test package description and annotation.
import org.junit.platform.suite.api.SelectPackages; /** * [1] */ @[2]("com.example.tests") package com.example.tests;
The package-info.java file documents the test package and uses the @SelectPackages annotation to specify the package for test discovery.
Fill all three blanks to define a test suite that runs all tests in the package.
import org.junit.platform.suite.api.Suite; import org.junit.platform.suite.api.[1]; @Suite @[2]("com.example.tests") public class [3] { }
The suite uses @SelectPackages to include all tests in the package. The class name 'TestSuite' is a common name for such suites.