-
-
Notifications
You must be signed in to change notification settings - Fork 481
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add docs for using consumer version selector methods with JUnit4
- Loading branch information
Showing
2 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...ider/junit/src/test/java/au/com/dius/pact/provider/junit/ConsumerVersionSelectorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package au.com.dius.pact.provider.junit; | ||
|
||
import au.com.dius.pact.provider.junit.target.HttpTarget; | ||
import au.com.dius.pact.provider.junitsupport.IgnoreNoPactsToVerify; | ||
import au.com.dius.pact.provider.junitsupport.Provider; | ||
import au.com.dius.pact.provider.junitsupport.loader.PactBroker; | ||
import au.com.dius.pact.provider.junitsupport.loader.PactBrokerConsumerVersionSelectors; | ||
import au.com.dius.pact.provider.junitsupport.loader.SelectorBuilder; | ||
import au.com.dius.pact.provider.junitsupport.target.Target; | ||
import au.com.dius.pact.provider.junitsupport.target.TestTarget; | ||
import org.junit.AfterClass; | ||
import org.junit.runner.RunWith; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.is; | ||
|
||
@RunWith(PactRunner.class) | ||
@Provider("myAwesomeService") | ||
@PactBroker(url = "http://broker.host") | ||
@IgnoreNoPactsToVerify(ignoreIoErrors = "true") | ||
public class ConsumerVersionSelectorTest { | ||
@TestTarget | ||
public final Target target = new HttpTarget(8332); | ||
|
||
static boolean called = false; | ||
@PactBrokerConsumerVersionSelectors | ||
public static SelectorBuilder consumerVersionSelectors() { | ||
called = true; | ||
return new SelectorBuilder().branch("current"); | ||
} | ||
|
||
@AfterClass | ||
public static void after() { | ||
assertThat("consumerVersionSelectors() was not called", called, is(true)); | ||
} | ||
} |