Why don't you wrap these two ExternalResources in your own ExternalResource , which calls the before and after methods in the order you need, in the methods of the new before and after resource.
Example:
public class MyResource extends ExternalResource{ private final List<ExternalResource> beforeResources; private final List<ExternalResource> afterResources; public MyResource(List<ExternalResource> beforeResources, List<ExternalResource> beforeResources){ } public void before(){ for (ExternalResource er : beforeResources) er.before(); } public void after(){ for (ExternalResource er : afterResources) er.after(); } } public class TestPigExternalResource {
source share