forked from karatelabs/karate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ConsumerIntegrationTest.java
executable file
·43 lines (36 loc) · 1.16 KB
/
ConsumerIntegrationTest.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
package payment.consumer;
import org.junit.jupiter.api.AfterAll;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.springframework.context.ConfigurableApplicationContext;
import payment.producer.Payment;
import payment.producer.PaymentService;
/**
*
* @author pthomas3
*/
class ConsumerIntegrationTest {
static ConfigurableApplicationContext context;
static Consumer consumer;
@BeforeAll
static void beforeAll() {
context = PaymentService.start(0);
String paymentServiceUrl = "http://localhost:" + PaymentService.getPort(context);
consumer = new Consumer(paymentServiceUrl);
}
@Test
void testPaymentCreate() throws Exception {
Payment payment = new Payment();
payment.setAmount(5.67);
payment.setDescription("test one");
payment = consumer.create(payment);
assertTrue(payment.getId() > 0);
assertEquals(payment.getAmount(), 5.67, 0);
assertEquals(payment.getDescription(), "test one");
}
@AfterAll
static void afterAll() {
PaymentService.stop(context);
}
}