test_class.declarator: registry
test_class.modifier: private
test_class.original_string: private RestExceptionHandlerRegistry registry;
test_class.type: RestExceptionHandlerRegistry
test_class.var_name: registry
test_class.file: neo-starter/src/test/java/eu/neoteric/starter/mvc/errorhandling/handler/RestExceptionHandlerRegistryTest.java
test_class.identifier: RestExceptionHandlerRegistryTest
test_case.body: @Test
      public void shouldReturnCloserMatchBinding() throws Exception {
          ExceptionHandlerBinding illegalStateBinding = ExceptionHandlerBinding.fromAnnotatedClass(IllegalStateExceptionHandler.class);
          ExceptionHandlerBinding runtimeBinding = ExceptionHandlerBinding.fromAnnotatedClass(RuntimeExceptionHandler.class);
          registry = new RestExceptionHandlerRegistry(Sets.newHashSet(illegalStateBinding, runtimeBinding));
          Optional<ExceptionHandlerBinding> foundBinding = registry.findBindingFor(IllegalComponentStateException.class);
          assertThat(foundBinding)
                  .isPresent()
                  .contains(illegalStateBinding);
      }
test_case.class_method_signature: RestExceptionHandlerRegistryTest.shouldReturnCloserMatchBinding()
test_case.full_signature: @Test public void shouldReturnCloserMatchBinding()
test_case.identifier: shouldReturnCloserMatchBinding
test_case.invocations: fromAnnotatedClass fromAnnotatedClass newHashSet findBindingFor contains isPresent assertThat
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void shouldReturnCloserMatchBinding()
focal_class.declarator: BEAN_NAME = "restExceptionHandlerRegistry"
focal_class.modifier: public static final
focal_class.original_string: public static final String BEAN_NAME = "restExceptionHandlerRegistry";
focal_class.type: String
focal_class.var_name: BEAN_NAME
focal_class.declarator: exceptionHandlerBindings
focal_class.modifier: private final
focal_class.original_string: private final Set<ExceptionHandlerBinding> exceptionHandlerBindings;
focal_class.type: Set<ExceptionHandlerBinding>
focal_class.var_name: exceptionHandlerBindings
focal_class.file: neo-starter/src/main/java/eu/neoteric/starter/mvc/errorhandling/handler/RestExceptionHandlerRegistry.java
focal_class.identifier: RestExceptionHandlerRegistry
focal_class.class_method_signature: RestExceptionHandlerRegistry.RestExceptionHandlerRegistry(Set<ExceptionHandlerBinding> bindings)
focal_class.full_signature: public  RestExceptionHandlerRegistry(Set<ExceptionHandlerBinding> bindings)
focal_class.identifier: RestExceptionHandlerRegistry
focal_class.modifiers: public
focal_class.parameters: (Set<ExceptionHandlerBinding> bindings)
focal_class.signature:  RestExceptionHandlerRegistry(Set<ExceptionHandlerBinding> bindings)
focal_class.class_method_signature: RestExceptionHandlerRegistry.findBindingFor(Class<? extends Throwable> exceptionClass)
focal_class.full_signature: public Optional<ExceptionHandlerBinding> findBindingFor(Class<? extends Throwable> exceptionClass)
focal_class.identifier: findBindingFor
focal_class.modifiers: public
focal_class.parameters: (Class<? extends Throwable> exceptionClass)
focal_class.return: Optional<ExceptionHandlerBinding>
focal_class.signature: Optional<ExceptionHandlerBinding> findBindingFor(Class<? extends Throwable> exceptionClass)
focal_class.class_method_signature: RestExceptionHandlerRegistry.getDistanceBetweenExceptions(Class<?> clazz, Class<?> mapperTypeClazz)
focal_class.full_signature: private int getDistanceBetweenExceptions(Class<?> clazz, Class<?> mapperTypeClazz)
focal_class.identifier: getDistanceBetweenExceptions
focal_class.modifiers: private
focal_class.parameters: (Class<?> clazz, Class<?> mapperTypeClazz)
focal_class.return: int
focal_class.signature: int getDistanceBetweenExceptions(Class<?> clazz, Class<?> mapperTypeClazz)
focal_method.body: public Optional<ExceptionHandlerBinding> findBindingFor(Class<? extends Throwable> exceptionClass) {
          if (exceptionHandlerBindings == null || exceptionHandlerBindings.isEmpty()) {
              return Optional.empty();
          }
          int currentDistance = Integer.MAX_VALUE;
          ExceptionHandlerBinding closestBinding = null;
          for (ExceptionHandlerBinding binding : exceptionHandlerBindings) {
              int tempDistance = getDistanceBetweenExceptions(exceptionClass, binding.getExceptionClass());
              if (tempDistance < currentDistance) {
                  currentDistance = tempDistance;
                  closestBinding = binding;
                  if (currentDistance == 0) {
                      break;
                  }
              }
          }
          return Optional.ofNullable(closestBinding);
      }
focal_method.class_method_signature: RestExceptionHandlerRegistry.findBindingFor(Class<? extends Throwable> exceptionClass)
focal_method.full_signature: public Optional<ExceptionHandlerBinding> findBindingFor(Class<? extends Throwable> exceptionClass)
focal_method.identifier: findBindingFor
focal_method.invocations: isEmpty empty getDistanceBetweenExceptions getExceptionClass ofNullable
focal_method.modifiers: public
focal_method.parameters: (Class<? extends Throwable> exceptionClass)
focal_method.return: Optional<ExceptionHandlerBinding>
focal_method.signature: Optional<ExceptionHandlerBinding> findBindingFor(Class<? extends Throwable> exceptionClass)