junit-team/junit — pull request #927 by boretti (2014-06-02 19:00:38+00:00)
Title: Add a new abstract test rule to delay the building of the rule

The purpose of this new Test Rule is to provide a way to delay the construction of the real used rule.

In some case, one rule require the output of another rule to be builded. As the required value is not available at this time, this rule provide a way to construct another rule, just before using it.

For instance, assume you have one rule (implementing ExternalResource), which provide access to a server, but only start this server (and so defining the URL) in the before method. If you have another rule that need this URL as a parameter, it will not work because the URL is not available at construct time.

Using DeferredRule, in this situation, it will be possible to construct the real rule (that need the URL), after the before method of the previous rule has been run.

The test case provide an example of how the rule are chained.