diff --git a/hystrix/pom.xml b/hystrix/pom.xml
index 920b825..a6289ec 100644
--- a/hystrix/pom.xml
+++ b/hystrix/pom.xml
@@ -28,6 +28,10 @@
org.springframework.boot
spring-boot-starter-web
+
+ org.springframework.boot
+ spring-boot-starter-actuator
+
org.springframework.cloud
spring-cloud-starter-hystrix
diff --git a/hystrix/src/test/java/demo/HystrixApplicationTests.java b/hystrix/src/test/java/demo/HystrixApplicationTests.java
index de6f0b1..bff821b 100644
--- a/hystrix/src/test/java/demo/HystrixApplicationTests.java
+++ b/hystrix/src/test/java/demo/HystrixApplicationTests.java
@@ -2,6 +2,7 @@ package demo;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -15,6 +16,9 @@ import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
+import java.io.InputStream;
+import java.net.URL;
+
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = HystrixApplication.class)
@IntegrationTest("server.port=0")
@@ -40,4 +44,20 @@ public class HystrixApplicationTests {
assertEquals("Bad status code", HttpStatus.OK, response.getStatusCode());
assertEquals("Wrong response text", "from the fallback", response.getBody());
}
+
+ @Test
+ public void hystrixStreamWorks() throws Exception {
+ String url = "http://localhost:" + port;
+ //you have to hit a Hystrix circuit breaker before the stream sends anything
+ ResponseEntity response = new TestRestTemplate().getForEntity(url, String.class);
+ assertEquals("bad response code", HttpStatus.OK, response.getStatusCode());
+
+ URL hystrixUrl = new URL(url + "/hystrix.stream");
+ InputStream in = hystrixUrl.openStream();
+ byte[] buffer = new byte[1024];
+ in.read(buffer);
+ String contents = new String(buffer);
+ assertTrue(contents.contains("ping"));
+ in.close();
+ }
}