I doing an CDC provider test with pact and spring, I was able to generate the pact file, but when I use the pact json for provider testing , it came out below error :"No tests found matching Method runTest", here is my code:
@RunWith(SpringRestPactRunner.class)
@Provider("myProvider")
@PactFolder("target/pacts")
@WebMvcTest(MyController.class)
public class ProviderTest {
@InjectMocks
private MyController myController; # the controller I want to test
@MockBean
private MyService myService; # the dependency of controller
@TestTarget
public final Target target = new SpringBootHttpTarget();
@State("my_state")
public void runTest() {
}
}
and the pact file is something like this:
... other parts
"providerStates": [
{
"name": "my_state"
}
]
... other parts
it seems that my test cannot find the "my_state" ?
EDIT: here is my demo project , Please help take a look, Thanks! https://github.com/wuhuanxing/pact_demo