Guest User

Untitled

a guest
Jan 23rd, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. @Test
  2. public void testFetchCustomerAccountDetailsHystrixTimeoutException() throws Exception {
  3. try {
  4. ConfigurationManager.getConfigInstance()
  5. .setProperty("hystrix.command.AIAClientCommand.circuitBreaker.forceOpen", "true");
  6. Mockito.when(service.fetchCustomerAccount(any(GetCustomerAccountType.class))).thenReturn(getTestAIARecord());
  7. GetCustomerAccountResponseType responseType = aiaUtilities
  8. .fetchCustomerAccountDetails(accountNumber);
  9. Assert.assertFalse(true);// if the flow came here, the test case has failed
  10. } catch (Exception ex) {
  11. if (ex instanceof DataAccessException) {
  12. assertEquals(Constants.ERRCODE_AIA_QUERY_TIMED_OUT,
  13. ((DataAccessException) ex).getErrorCode());
  14. } else {
  15. throw ex;
  16. }
  17. }
  18. finally {
  19. ConfigurationManager.getConfigInstance()
  20. .setProperty("hystrix.command.AIAClientCommand.circuitBreaker.forceOpen", "false");
  21. }
  22. }
Add Comment
Please, Sign In to add comment