org.fest.util.Files Java Examples
The following examples show how to use
org.fest.util.Files.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AssertJSwingTest.java From Pixelitor with GNU General Public License v3.0 | 6 votes |
private static void cleanOutputs() { try { String cleanerScriptPath = cleanerScript.getCanonicalPath(); System.out.println("AssertJSwingTest::cleanOutputs: running " + cleanerScript); Process process = Runtime.getRuntime().exec(cleanerScriptPath); int exitValue = process.waitFor(); if (exitValue != 0) { throw new IllegalStateException("Exit value for " + cleanerScriptPath + " was " + exitValue); } assertThat(Files.fileNamesIn(batchResizeOutputDir.getPath(), false)).isEmpty(); assertThat(Files.fileNamesIn(batchFilterOutputDir.getPath(), false)).isEmpty(); } catch (IOException | InterruptedException e) { e.printStackTrace(); } }
Example #2
Source File: ParseClipboardTest.java From otroslogviewer with Apache License 2.0 | 5 votes |
@Test(retryAnalyzer = RetryAnalyzer.class) public void pasteClipboardOnOpen() throws IOException { final File file1 = File.createTempFile("otrosTest", ""); logEvents(file1, 10); final String clipboardContent = Files.contentOf(file1, "UTF-8"); setClipboard(clipboardContent); final MainFrame mainFrame = new MainFrame(robot()); final ParseClipboardDialog dialog = mainFrame.welcomeScreen().clickParseClipboard(); final String actual = dialog.clipboardTextAreaContent().text(); assertThat(actual).isEqualTo(clipboardContent); }
Example #3
Source File: ParseClipboardTest.java From otroslogviewer with Apache License 2.0 | 5 votes |
@Test(retryAnalyzer = RetryAnalyzer.class) public void importLogsFromClipboard() throws Exception { final File tempFile = File.createTempFile("olv", "logs"); logEvents(tempFile, 10, integer -> Level.INFO); final String logsInClipboard = Files.contentOf(tempFile, "UTF-8").trim(); final MainFrame mainFrame = new MainFrame(robot()); final ParseClipboardDialog dialog = mainFrame.welcomeScreen().clickParseClipboard(); setClipboard(logsInClipboard); dialog.refresh().click(); dialog.waitForProcessedContent(logsInClipboard); assertThat(dialog.processedContent().text()).isEqualTo(logsInClipboard); dialog.processingPattern().setText("sed s/Message/XXX/g"); dialog.waitForProcessedContent(logsInClipboard.replaceAll("Message", "XXX")); final LogViewPanel logViewPanel = dialog.importLogs(); await("waiting for 10 events in log table") .atMost(Duration.ONE_MINUTE) .until(() -> logViewPanel.logsTable().visibleLogsCount() == 10); IntStream.range(0, 9) .forEach(i -> logViewPanel.logsTable().hasValueInRow(i, "XXX " + i)); }
Example #4
Source File: FileHandlerTests.java From slf4android with MIT License | 5 votes |
private String readAndClearFileEntries() throws IOException { handler.flush(); String currentFileName = handler.getCurrentFileName(); String contents = Files.contentOf(new File(currentFileName), Charset.forName("UTF-8")); FileChannel outChan = new FileOutputStream(currentFileName, true).getChannel(); outChan.truncate(0); outChan.close(); return contents; }