diff --git a/src/test/java/de/danielluedecke/zettelkasten/ZettelkastenViewUpdateDisplayTest.java b/src/test/java/de/danielluedecke/zettelkasten/ZettelkastenViewUpdateDisplayTest.java index 0fd6f6ca..85fa77c6 100644 --- a/src/test/java/de/danielluedecke/zettelkasten/ZettelkastenViewUpdateDisplayTest.java +++ b/src/test/java/de/danielluedecke/zettelkasten/ZettelkastenViewUpdateDisplayTest.java @@ -11,6 +11,9 @@ import org.jdesktop.application.SingleFrameApplication; +import java.awt.GraphicsEnvironment; +import org.testng.SkipException; + public class ZettelkastenViewUpdateDisplayTest { private ZettelkastenView zettelkastenView; @@ -20,6 +23,11 @@ public class ZettelkastenViewUpdateDisplayTest { @BeforeMethod public void setUp() throws Exception { + // Check if the environment is headless, and skip the test if so + if (GraphicsEnvironment.isHeadless()) { + throw new SkipException("Test skipped: Headless environment detected."); + } + settings = new Settings(); tasksData = new TasksData(); data = new Daten(zettelkastenView, settings, null, null); @@ -31,9 +39,14 @@ protected void startup() { zettelkastenView = new ZettelkastenView(app, settings, tasksData); zettelkastenView.setData(data); } - + @Test public void testUpdateEntryPaneAndKeywordsPaneInvalidEntry() { + // Check if the environment is headless and skip the test if so + if (GraphicsEnvironment.isHeadless()) { + throw new SkipException("Test skipped: Headless environment detected."); + } + int invalidEntryNumber = 0; zettelkastenView.updateEntryPaneAndKeywordsPane(invalidEntryNumber); @@ -41,7 +54,7 @@ public void testUpdateEntryPaneAndKeywordsPaneInvalidEntry() { assertTrue(zettelkastenView.jEditorPaneEntry.getText().contains("")); assertTrue(zettelkastenView.keywordListModel.isEmpty()); assertEquals(zettelkastenView.jTextFieldEntryNumber.getText(), ""); - assertEquals(zettelkastenView.statusOfEntryLabel.getText(), - zettelkastenView.getResourceMap().getString("entryOfText")); + assertEquals(zettelkastenView.statusOfEntryLabel.getText(), + zettelkastenView.getResourceMap().getString("entryOfText")); } -} \ No newline at end of file +}