Files
spring-boot-rest/ratpack/src/test/java/com/baeldung/hystrix/RatpackHystrixAppLiveTest.java
2017-08-21 22:58:37 +02:00

51 lines
1.2 KiB
Java

package com.baeldung.hystrix;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import ratpack.test.MainClassApplicationUnderTest;
import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.assertThat;
/**
* @author aiet
*/
public class RatpackHystrixAppLiveTest {
static MainClassApplicationUnderTest appUnderTest;
@BeforeClass
public static void setup() {
System.setProperty("ratpack.hystrix.timeout", "5000");
appUnderTest = new MainClassApplicationUnderTest(RatpackHystrixApp.class);
}
@Test
public void whenFetchReactive_thenGotEugenProfile() {
assertThat(appUnderTest
.getHttpClient()
.getText("rx"), containsString("www.baeldung.com"));
}
@Test
public void whenFetchAsync_thenGotEugenProfile() {
assertThat(appUnderTest
.getHttpClient()
.getText("async"), containsString("www.baeldung.com"));
}
@Test
public void whenFetchSync_thenGotEugenProfile() {
assertThat(appUnderTest
.getHttpClient()
.getText("sync"), containsString("www.baeldung.com"));
}
@AfterClass
public static void clean() {
appUnderTest.close();
}
}