SpectoLabs / hoverfly-java

Java binding for Hoverfly
Apache License 2.0
168 stars 58 forks source link

False @ClassRule Warning #215

Closed garyluu closed 5 years ago

garyluu commented 5 years ago

Description of the bug

Even when used with @ClassRule the It is recommended to use HoverflyRule with @ClassRule warning still appears

Steps to reproduce the issue

public class IT {
    @ClassRule
    public static HoverflyRule hoverflyRule = HoverflyRule.inSimulationMode(SIMULATION_SOURCE);

    @Rule
    public TestRule watcher = new TestWatcher() {
        protected void starting(Description description) {
            System.out.println("Starting test: " + description.getMethodName());
        }
    };

    @Test
    public void test() {
    }
}

Observed result

Hoverfly Java and Hoverfly error messages seen (If none, say none)

16:17:20.400 [main] WARN  i.s.hoverfly.junit.rule.HoverflyRule - It is recommended to use HoverflyRule with @ClassRule to get better performance in your tests, and prevent known issue with Apache HttpClient. For more information, please see http://hoverfly-java.readthedocs.io/en/latest/pages/misc/misc.html#apache-httpclient.

If possible, add screenshots to help explain your problem

Expected result

There should be no warning

Additional relevant information

If not indicated above:

  1. Hoverfly Java version: 0.12.0
  2. Anything that might help us to diagnose the problem Removing the watcher seems to also remove the warning
tommysitu commented 5 years ago

I can reproduce the issue, this method could be buggy: https://github.com/SpectoLabs/hoverfly-java/blob/master/src/main/java/io/specto/hoverfly/junit/rule/HoverflyRule.java#L285

You're welcome to send a PR if you have a solution. Thanks!

tommysitu commented 5 years ago

Fixed in 0.12.1