Explorer extends javax.swing.JFrame { @SuppressFBWarnings("PATH_TRAVERSAL_IN") public Explorer(final File... openFiles) throws IOException { if (openFiles.length == 0) { folder = new File(org.spf4j.base.Runtime.USER_DIR); } else { folder = openFiles[0].getParentFile(); } initComponents(); for (File file : openFiles) { openFile(file); } } @SuppressFBWarnings("PATH_TRAVERSAL_IN")  Explorer(final File... openFiles); JMenuBar createContextMenuBar(); static void main(final String[] args);  }
@Test @SuppressFBWarnings("MDM_THREAD_YIELD") public void testExplorer() throws InterruptedException { Assume.assumeTrue(TestUtils.isExecutedInCI()); ObservationAssert expectation = TestLoggers.sys().expectUncaughtException(2, TimeUnit.SECONDS, UncaughtExceptionDetail.hasThrowable((Matcher) Matchers.any(ExitException.class))); JFrame tFrame = GuiActionRunner.execute(() -> new Explorer()); FrameFixture window = new FrameFixture(tFrame); Settings settings = window.robot().settings(); settings.delayBetweenEvents(130); settings.eventPostingDelay(100); window.show(); Assert.assertTrue(window.isEnabled()); JMenuItemFixture openFileMenuItem = window.menuItem(new GenericTypeMatcher<JMenuItem>(JMenuItem.class) { @Override protected boolean isMatching(final JMenuItem component) { return "Open".equals(component.getText()); } }); openFileMenuItem.click(); Thread.sleep(100); JFileChooserFixture fileChooser = window.fileChooser("openFileDialog"); fileChooser.setCurrentDirectory(new File("src/test/resources")); fileChooser.selectFile(new File( "src/test/resources/com.google.common.io.AppendableWriterBenchmark.spf4jAppendable-Throughput.ssdump2") .getAbsoluteFile()); fileChooser.approve(); Assert.assertNotNull(window.internalFrame( "com.google.common.io.AppendableWriterBenchmark.spf4jAppendable-Throughput.ssdump2")); openFileMenuItem.click(); Thread.sleep(100); fileChooser = window.fileChooser("openFileDialog"); fileChooser.setCurrentDirectory(new File("src/test/resources")); Thread.sleep(100); fileChooser.selectFile(new File("src/test/resources/" + "19156@ZMacBookPro.local.tsdb").getAbsoluteFile()); fileChooser.approve(); Assert.assertNotNull(window.internalFrame( "19156@ZMacBookPro.local.tsdb")); openFileMenuItem.click(); Thread.sleep(100); fileChooser = window.fileChooser("openFileDialog"); fileChooser.setCurrentDirectory(new File("src/test/resources")); Thread.sleep(100); fileChooser.selectFile(new File("src/test/resources/" + "test8381720042200787335.tsdb2").getAbsoluteFile()); fileChooser.approve(); Assert.assertNotNull(window.internalFrame( "test8381720042200787335.tsdb2")); JMenuItemFixture openJsonText = window.menuItem(new GenericTypeMatcher<JMenuItem>(JMenuItem.class) { @Override protected boolean isMatching(final JMenuItem component) { return "From Text/URL".equals(component.getText()); } }); openJsonText.click(); Thread.sleep(100); DialogFixture dialog = window.dialog("fromTextDialog"); dialog.textBox("textBox").setText("{\"ROOT@49924@ZMacBookPro-2.local\":10," + "\"c\":[{\"m3@C2\":2,\"c\":[{\"m2@C2\":2,\"c\":[{\"m1@C2\":2}]}]},{\"m1@C1\":2}," + "{\"m3@C1\":4,\"c\":[{\"m2@C1\":4,\"c\":[{\"m1@C1\":4}]}]}," + "{\"m4@C1\":2,\"c\":[{\"m2@C1\":2,\"c\":[{\"m1@C1\":2}]}]}]}"); dialog.button("display").click(); Assert.assertNotNull(window.internalFrame("SampleNode Tree")); window.close(); window.cleanUp(); expectation.assertObservation(); }