We’re using Pact to write and run our contract tests. Pact has its own annotation for their provider tests, e.g. @State
instead of @Test
to run the ‘states’ defined in the contract automatically against the service in test.
This results in many false positives “TestCases should contain tests” code smell with blocker severity.
Is there a work around or something that can be added to SQ to accommodate:
- versions used: 8.4.2.36762
Sample code:
@Provider("derp")
@Consumer("glory")
@PactBroker
@RunWith(RestPactRunner.class)
public class FooProviderPactTest {
@TestTarget
public final MockMvcTarget target = new MockMvcTarget();
@Before
public void before() {
MockitoAnnotations.initMocks(this);
}
@State("Test State A")
public void testA() {
// Prepare service before interaction that require "default" state
// ...
System.out.println("Now service in default state");
}
@State("Test State B")
public void testB() {
// Prepare service before interaction that require B state
// ...
System.out.println("Now service in B state");
}
This is something similar to: https://jira.sonarsource.com/browse/SONARJAVA-3102