-
Notifications
You must be signed in to change notification settings - Fork 0
/
ConsumerIntegrationTest.java
43 lines (36 loc) · 1.19 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.AfterClass;
import org.junit.Test;
import static org.junit.Assert.*;
import org.junit.BeforeClass;
import org.springframework.context.ConfigurableApplicationContext;
import payment.producer.Payment;
import payment.producer.PaymentService;
/**
*
* @author pthomas3
*/
public class ConsumerIntegrationTest {
private static ConfigurableApplicationContext context;
private static Consumer consumer;
@BeforeClass
public static void beforeClass() {
context = PaymentService.start();
String paymentServiceUrl = "http://localhost:" + PaymentService.getPort(context);
consumer = new Consumer(paymentServiceUrl);
}
@Test
public 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");
}
@AfterClass
public static void afterClass() {
PaymentService.stop(context);
}
}