forked from karatelabs/karate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PaymentServiceContractUsingMockTest.java
44 lines (37 loc) · 1.28 KB
/
PaymentServiceContractUsingMockTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package mock.contract;
import com.intuit.karate.Results;
import com.intuit.karate.Runner;
import com.intuit.karate.core.MockServer;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
/**
*
* @author pthomas3
*/
class PaymentServiceContractUsingMockTest {
static MockServer server;
static String queueName = "DEMO.CONTRACT.MOCK";
@BeforeAll
static void beforeAll() {
server = MockServer
.feature("classpath:mock/contract/payment-service-mock.feature")
.arg("queueName", queueName)
.http(0).build();
}
@Test
void testPaymentService() {
String paymentServiceUrl = "http://localhost:" + server.getPort();
Results results = Runner.path("classpath:mock/contract/payment-service.feature")
.configDir("classpath:mock/contract")
.systemProperty("payment.service.url", paymentServiceUrl)
.systemProperty("shipping.queue.name", queueName)
.parallel(1);
assertTrue(results.getFailCount() == 0, results.getErrorMessages());
}
@AfterAll
static void afterAll() {
server.stop();
}
}