Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Test
- public void testFetchCustomerAccountDetailsHystrixTimeoutException() throws Exception {
- try {
- ConfigurationManager.getConfigInstance()
- .setProperty("hystrix.command.AIAClientCommand.circuitBreaker.forceOpen", "true");
- Mockito.when(service.fetchCustomerAccount(any(GetCustomerAccountType.class))).thenReturn(getTestAIARecord());
- GetCustomerAccountResponseType responseType = aiaUtilities
- .fetchCustomerAccountDetails(accountNumber);
- Assert.assertFalse(true);// if the flow came here, the test case has failed
- } catch (Exception ex) {
- if (ex instanceof DataAccessException) {
- assertEquals(Constants.ERRCODE_AIA_QUERY_TIMED_OUT,
- ((DataAccessException) ex).getErrorCode());
- } else {
- throw ex;
- }
- }
- finally {
- ConfigurationManager.getConfigInstance()
- .setProperty("hystrix.command.AIAClientCommand.circuitBreaker.forceOpen", "false");
- }
- }
Add Comment
Please, Sign In to add comment