ExceptionHandlerBinding { public static ExceptionHandlerBinding fromAnnotatedClass(Class<?> exceptionHandlerClass) { Assert.notNull(exceptionHandlerClass); RestExceptionHandlerProvider annotation = exceptionHandlerClass.getAnnotation(RestExceptionHandlerProvider.class); Assert.state(annotation != null, exceptionHandlerClass + " class in not annotated with @RestExceptionHandlerProvider"); return builder() .exceptionHandlerClass(exceptionHandlerClass) .logger(LoggerFactory.getLogger(exceptionHandlerClass)) .exceptionClass(getExceptionClass(exceptionHandlerClass)) .exceptionHandlerBeanName(getHandlerBeanName(exceptionHandlerClass)) .httpStatus(annotation.httpStatus()) .cause(annotation.applicationCode()) .logLevel(annotation.logLevel()) .suppressStacktrace(annotation.suppressStackTrace()) .suppressException(annotation.suppressException()) .build(); }  static ExceptionHandlerBinding fromAnnotatedClass(Class<?> exceptionHandlerClass);  }
@Test public void shouldThrowException_WhenNullProvided() throws Exception { expectedException.expect(IllegalArgumentException.class); ExceptionHandlerBinding.fromAnnotatedClass(null); }
@Test public void shouldThrowException_WhenNotImplementingRestExceptionProvider() throws Exception { expectedException.expect(IllegalStateException.class); ExceptionHandlerBinding.fromAnnotatedClass(ExceptionProviderNotImplementing.class); }
@Test public void shouldThrowException_WhenNotRestExceptionProviderAnnotated() throws Exception { expectedException.expect(IllegalStateException.class); ExceptionHandlerBinding.fromAnnotatedClass(ExceptionProviderNotAnnotated.class); }