@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); } } }