@Override
    public boolean addClass(final Class<?> stepClass) {
        if (stepClasses.contains(stepClass)) {
            return true;
        }

        checkNoComponentAnnotations(stepClass);
        if (hasCucumberContextConfiguration(stepClass)) {
            checkOnlyOneClassHasCucumberContextConfiguration(stepClass);
            withCucumberContextConfiguration = stepClass;
        }
        stepClasses.add(stepClass);
        return true;
    }
@Test
    void shouldFailIfClassWithSpringComponentAnnotationsIsFound() {
        final ObjectFactory factory = new SpringFactory();

        Executable testMethod = () -> factory.addClass(WithComponentAnnotation.class);
        CucumberBackendException actualThrown = assertThrows(CucumberBackendException.class, testMethod);
        assertThat(actualThrown.getMessage(), is(equalTo(
            "Glue class io.cucumber.spring.componentannotation.WithComponentAnnotation was (meta-)annotated with @Component; marking it as a candidate for auto-detection by Spring. Glue classes are detected and registered by Cucumber. Auto-detection of glue classes by spring may lead to duplicate bean definitions. Please remove the @Component (meta-)annotation")));
    }