forked from sqshq/piggymetrics
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add unit test for StatisticsServiceClientFallback
- Loading branch information
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
...ce/src/test/java/com/piggymetrics/account/client/StatisticsServiceClientFallbackTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.piggymetrics.account.client; | ||
|
||
import com.piggymetrics.account.domain.Account; | ||
import org.junit.Before; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.boot.test.rule.OutputCapture; | ||
import org.springframework.test.context.junit4.SpringRunner; | ||
|
||
import static org.hamcrest.Matchers.containsString; | ||
|
||
/** | ||
* @author cdov | ||
*/ | ||
@RunWith(SpringRunner.class) | ||
@SpringBootTest(properties = { | ||
"feign.hystrix.enabled=true" | ||
}) | ||
public class StatisticsServiceClientFallbackTest { | ||
@Autowired | ||
private StatisticsServiceClient statisticsServiceClient; | ||
|
||
@Rule | ||
public final OutputCapture outputCapture = new OutputCapture(); | ||
|
||
@Before | ||
public void setup() { | ||
outputCapture.reset(); | ||
} | ||
|
||
@Test | ||
public void testUpdateStatisticsWithFailFallback(){ | ||
statisticsServiceClient.updateStatistics("test", new Account()); | ||
|
||
outputCapture.expect(containsString("Error during update statistics for account: test")); | ||
|
||
} | ||
|
||
} | ||
|