I'm trying to write conditional tests with JUnit. I need to test the persistence of objects and if those tests pass, test access via HTTP methods (in order to develop a REST Web Service).
For this moment my solution looks like this :
public class ApplicationTest {
@Test
public void testSuite() {
final Request requestStatutTest = Request.method(this.getClass(), "insertStatutTest");
final Result resStatutTest = new JUnitCore().run(requestStatutTest);
if (resStatutTest.wasSuccessful()) {
postStatutTest();
getStatutTest();
putStatutTest();
deleteStatutTest();
}
public void insertStatutTest() {
}
public void postStatutTest() {
}
// etc...
}
Is it the good solution ?