Last active
December 11, 2020 19:13
-
-
Save artemptushkin/ad3b610ab9f32984aae750204cce6294 to your computer and use it in GitHub Desktop.
The basic setup of pact provider using `au.com.dius.pact.provider:junit`
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
@RunWith(RestPactRunner.class) | |
@Provider("billing") | |
@PactBroker(consumerVersionSelectors = { | |
@VersionSelector(consumer = "transactions") | |
}) | |
public class TariffProviderPactTest { | |
@Autowired | |
private TariffRepository tariffRepository; | |
@TestTarget | |
public final Target target = new HttpTarget("http", "localhost", 8080); | |
private Long id; | |
@State(value = "tariff-for-transactions", action = StateChangeAction.SETUP) | |
public void subscriptionStationState() { | |
Tariff tariff = new Tariff(1.10, 2.25); | |
tariffRepository.save(tariff); | |
id = tariff.getId(); | |
} | |
@State(value = "tariff-for-transactions", action = StateChangeAction.TEARDOWN) | |
public void subscriptionStationState() { | |
tariffRepository.deleteById(id); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment