Skip to content

Commit

Permalink
add unit test for StatisticsServiceClientFallback
Browse files Browse the repository at this point in the history
  • Loading branch information
chidov committed Sep 11, 2018
1 parent 5cb4627 commit 469455d
Showing 1 changed file with 43 additions and 0 deletions.
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"));

}

}

0 comments on commit 469455d

Please sign in to comment.