BLogicExceptionHandlerResolverImpl implements
                                                BLogicExceptionHandlerResolver { @Override public ExceptionHandler resolveExceptionHandler(ApplicationContext ctx, String jobAppCd) { if (jobAppCd == null || jobAppCd.length() == 0) { return null; } if (ctx == null) { return null; } String handlerName = jobAppCd + EXCEPTION_HANDLER_BEAN_NAME_SUFFIX; String decapitalizedName = Introspector.decapitalize(handlerName); if (ctx.containsBean(handlerName)) { return ctx.getBean(handlerName, ExceptionHandler.class); } if (ctx.containsBean(decapitalizedName)) { return ctx.getBean(decapitalizedName, ExceptionHandler.class); } if (ctx.containsBean(DEFAULT_EXCEPTION_HANDLER_BEAN_NAME)) { return ctx.getBean(DEFAULT_EXCEPTION_HANDLER_BEAN_NAME, ExceptionHandler.class); } return null; }  @Override ExceptionHandler resolveExceptionHandler(ApplicationContext ctx,
            String jobAppCd);  }
@Test public void testResolveExceptionHandler02() { String jobAppCd = "B01"; String handlerName = jobAppCd + suffix; when(ctx.containsBean(handlerName)).thenReturn(false); when(ctx.containsBean("b01" + suffix)).thenReturn(true); when(ctx.getBean("b01" + suffix, ExceptionHandler.class)).thenReturn(exHandler); ExceptionHandler result = target.resolveExceptionHandler(ctx, jobAppCd); assertSame(exHandler, result); }
@Test public void testResolveExceptionHandler03() { when(ctx.containsBean(anyString())).thenReturn(false); when(ctx.containsBean(defaultName)).thenReturn(true); ExceptionHandler defaultHandler = new DefaultExceptionHandler(); when(ctx.getBean(defaultName, ExceptionHandler.class)).thenReturn(defaultHandler); ExceptionHandler result = target.resolveExceptionHandler(ctx, "DEFINE_NOT_EXIST"); assertSame(defaultHandler, result); }
@Test public void testResolveExceptionHandler04() { when(ctx.containsBean(anyString())).thenReturn(false); ExceptionHandler result = target.resolveExceptionHandler(ctx, "DEFINE_NOT_EXIST"); assertNull(result); }
@Test public void testResolveExceptionHandler05() { ExceptionHandler result = target.resolveExceptionHandler(null, "DEFINE_NOT_EXIST"); assertNull(result); }
@Test public void testResolveExceptionHandler06() { ExceptionHandler result = target.resolveExceptionHandler(ctx, null); assertNull(result); }
@Test public void testResolveExceptionHandler07() { ExceptionHandler result = target.resolveExceptionHandler(ctx, ""); assertNull(result); }
@Test public void testResolveExceptionHandler01() { String jobAppCd = "B01"; String handlerName = jobAppCd + suffix; when(ctx.containsBean(handlerName)).thenReturn(true); when(ctx.getBean(handlerName, ExceptionHandler.class)).thenReturn(exHandler); ExceptionHandler result = target.resolveExceptionHandler(ctx, jobAppCd); assertSame(exHandler, result); }