ore robust hystrix test

This commit is contained in:
Ryan Baxter
2016-07-21 10:52:43 -04:00
parent 581e09e66e
commit 0de3d12965
2 changed files with 9 additions and 5 deletions

View File

@@ -34,9 +34,9 @@ public class HystrixApplication {
@RequestMapping("/fail")
public String fail(@RequestHeader(name = "X-No-Fail", required = false) String noFail) {
if (noFail != null) {
return this.myService.ok();
return this.myService.fail(false);
}
return this.myService.fail();
return this.myService.fail(true);
}
public static void main(String[] args) {

View File

@@ -13,11 +13,15 @@ public class MyService {
}
@HystrixCommand(fallbackMethod = "fallback")
public String fail() {
throw new RuntimeException("fail now");
public String fail(boolean throwSomething) {
if(throwSomething)
throw new RuntimeException("fail now");
else
return "";
}
public String fallback() {
public String fallback(boolean throwSomething) {
return "from the fallback";
}
}