I have two classes.
One with a JUnit Test as follows:
public class ValidateResponseCodeTest {
@ClassRule
//code here
@BeforeClass
//more code
@Test
public void sendAndReceiveCodeCheck() {
// test code goes here
System.out.println("only this ran!");
}
}
Then I have another class which i want to use to invoke that test sendAndReceiveCodeCheck
Public class AllTests {
@ClassRule
//code here
@BeforeClass
//more code
private final ValidateResponseCodeTest validateResponseCodeTest;
public AllTests() {
validateResponseCodeTest = new ValidateResponseCodeTest();
}
@Test
public void runTest() {
ValidateResponseCodeTest.sendAndReceiveCodeCheck();
}
}
How can i ensure that the method runTest()
ONLY runs the code within test method sendAndReceiveCodeCheck
and not run all code in class: ValidateResponseCodeTest
Ideally, I don't want to remove annotations or touch ValidateResponseCodeTest
class in any way.