public Statement apply()

in src/main/java/org/apache/sling/testing/junit/rules/InstanceConfigRule.java [61:85]


    public Statement apply(final Statement base, Description description) {
        return new Statement() {
            @Override
            public void evaluate() throws Throwable {
                // save the instance config
                LOG.debug("Saving instance config {}", instanceConfig.getClass());
                instanceConfig.save();
                
                // Call any actions if any
                for (Action action : actions) {
                    LOG.debug("Calling action {}", action.getClass());
                    action.call();
                }
                
                // run the base statement
                LOG.debug("Running base statement");
                base.evaluate();
                
                if (withRestore) {
                    LOG.debug("Restoring instance config {}", instanceConfig.getClass());
                    instanceConfig.restore();
                }
            }
        };
    }