private VerificationResult runPactTest(final Statement base, PactFragment pactFragment) { return pactFragment.runConsumer(config, new TestRun() { @Override public void run(MockProviderConfig config) throws Throwable { base.evaluate(); } }); }
/** * Terminates the DSL and builds a pact fragment to represent the interactions * * @deprecated Use toPact instead */ public PactFragment toFragment() { addInteraction(); return new PactFragment( request.consumer, request.provider, JavaConversions$.MODULE$.asScalaBuffer(consumerPactBuilder.getInteractions()).toSeq()); }
/** * Terminates the DSL and builds a pact fragment to represent the interactions * * @deprecated Use toPact instead */ public PactFragment toFragment() { addInteraction(); return new PactFragment( request.consumer, request.provider, JavaConversions$.MODULE$.asScalaBuffer(consumerPactBuilder.getInteractions()).toSeq()); }
private VerificationResult runPactTest(final Statement base, PactFragment pactFragment) { return pactFragment.runConsumer(config, new TestRun() { @Override public void run(MockProviderConfig config) throws Throwable { base.evaluate(); } }); }
private VerificationResult runPactTest(EventContext<Test> base, PactFragment pactFragment) { return pactFragment.runConsumer(mockProviderConfigInstance.get(), mockProviderConfig -> base.proceed()); }
private VerificationResult runPactTest(EventContext<Test> base, PactFragment pactFragment) { return pactFragment.runConsumer(mockProviderConfigInstance.get(), mockProviderConfig -> base.proceed()); }
VerificationResult result = fragment.runConsumer(config, new TestRun() {
VerificationResult result = fragment.runConsumer(config, new TestRun() {
@Test public void testPact() throws Throwable { PactFragment fragment = createFragment(ConsumerPactBuilder.consumer(consumerName()).hasPactWith(providerName())); final MockProviderConfig config = MockProviderConfig.createDefault(getSpecificationVersion()); VerificationResult result = fragment.runConsumer(config, config1 -> runTest(config1.url())); if (!result.equals(PACT_VERIFIED)) { if (result instanceof PactError) { throw ((PactError)result).error(); } if (result instanceof UserCodeFailed) { throw ((UserCodeFailed<RuntimeException>)result).error(); } if (result instanceof PactMismatch) { PactMismatch mismatch = (PactMismatch) result; throw new PactMismatchException(mismatch); } } }
@Test public void testPact() throws Throwable { PactFragment fragment = createFragment(ConsumerPactBuilder.consumer(consumerName()).hasPactWith(providerName())); final MockProviderConfig config = MockProviderConfig.createDefault(getSpecificationVersion()); VerificationResult result = fragment.runConsumer(config, config1 -> runTest(config1.url())); if (!result.equals(PACT_VERIFIED)) { if (result instanceof PactError) { throw ((PactError)result).error(); } if (result instanceof UserCodeFailed) { throw ((UserCodeFailed<RuntimeException>)result).error(); } if (result instanceof PactMismatch) { PactMismatch mismatch = (PactMismatch) result; throw new PactMismatchException(mismatch); } } }