Make ResourceTest a JUnit TestRule

TestRules are much more flexible. They can be run at either the class or
the test level, and can be combined with other TestRules for more
complex behaviour.
Merge pull request #394 from nicktelford/feature/resource-test-rule

Make ResourceTest a JUnit TestRule