Currently we use static expect() and rely on ThreadLocal to choose the correct Thread. The logic to do this is becoming messy and unreliable - Threads are shared across methods and it also doesn't work with parallel tests #43 .
Instead of using static methods, use the testing framework to inject the instance created via start() into the test. Different testing framework have different ways of doing this.
My initial though is to inject it into the method signature but there might be other ways such as an instance variable.
@Test
public void myTest(SnapshotMatcher expect) {
expect("Hello World").toMatchSnapshot();
}
This may warrant a 3.0.0 version upgrade.
Currently we use static
expect()and rely on ThreadLocal to choose the correct Thread. The logic to do this is becoming messy and unreliable - Threads are shared across methods and it also doesn't work with parallel tests #43 .Instead of using static methods, use the testing framework to inject the instance created via
start()into the test. Different testing framework have different ways of doing this.My initial though is to inject it into the method signature but there might be other ways such as an instance variable.
This may warrant a
3.0.0version upgrade.