@Override
    public Status check() {

        if (applicationContext == null && applicationModel != null) {
            SpringExtensionInjector springExtensionInjector = SpringExtensionInjector.get(applicationModel);
            applicationContext = springExtensionInjector.getContext();
        }

        if (applicationContext == null) {
            return new Status(Status.Level.UNKNOWN);
        }

        Status.Level level;
        if (applicationContext instanceof Lifecycle) {
            if (((Lifecycle) applicationContext).isRunning()) {
                level = Status.Level.OK;
            } else {
                level = Status.Level.ERROR;
            }
        } else {
            level = Status.Level.UNKNOWN;
        }
        StringBuilder buf = new StringBuilder();
        try {
            Class<?> cls = applicationContext.getClass();
            Method method = null;
            while (cls != null && method == null) {
                try {
                    method = cls.getDeclaredMethod("getConfigLocations", new Class<?>[0]);
                } catch (NoSuchMethodException t) {
                    cls = cls.getSuperclass();
                }
            }
            if (method != null) {
                if (!method.isAccessible()) {
                    method.setAccessible(true);
                }
                String[] configs = (String[]) method.invoke(applicationContext, new Object[0]);
                if (configs != null && configs.length > 0) {
                    for (String config : configs) {
                        if (buf.length() > 0) {
                            buf.append(',');
                        }
                        buf.append(config);
                    }
                }
            }
        } catch (Throwable t) {
            if (t.getCause() instanceof UnsupportedOperationException) {
                logger.debug(t.getMessage(), t);
            } else {
                logger.warn(CONFIG_WARN_STATUS_CHECKER, "", "", t.getMessage(), t);
            }
        }
        return new Status(level, buf.toString());
    }
@Test
    void testWithoutLifeCycleRunning() {
        ApplicationLifeCycle applicationLifeCycle = mock(ApplicationLifeCycle.class);
        given(applicationLifeCycle.isRunning()).willReturn(false);

        SpringStatusChecker springStatusChecker = new SpringStatusChecker(applicationLifeCycle);
        Status status = springStatusChecker.check();

        assertThat(status.getLevel(), is(Status.Level.ERROR));
    }