@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 shouldBeStoppableWhenFacedWithInvalidConfiguration() {
        final ObjectFactory factory = new SpringFactory();
        factory.addClass(WithEmptySpringAnnotations.class);

        IllegalStateException exception = assertThrows(IllegalStateException.class, factory::start);
        assertThat(exception.getMessage(),
            containsString("DelegatingSmartContextLoader was unable to detect defaults"));
        assertDoesNotThrow(factory::stop);
    }