Пример #1
0
 public static void assumeNotHeadless() {
   boolean headless = true;
   try {
     GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
     headless = ge.isHeadless();
   } catch (Exception e) {
     e.printStackTrace();
   } catch (Error e) {
     // Really not sure why this ever happens, maybe just jenkins issues
     e.printStackTrace();
   }
   if (headless) {
     System.out.println("You are trying to start a GUI in a headless environment. Aborting test");
   }
   org.junit.Assume.assumeTrue(!headless);
 }