private static boolean isInHeadlessMode() {
    Application application = ApplicationManager.getApplication();
    return application.isUnitTestMode() || application.isHeadlessEnvironment();
  }
private static boolean isInHeadlessMode()