summaryrefslogtreecommitdiffstats
path: root/vespajlib/src/test/java/com/yahoo/system/ProcessExecuterTestCase.java
diff options
context:
space:
mode:
Diffstat (limited to 'vespajlib/src/test/java/com/yahoo/system/ProcessExecuterTestCase.java')
-rw-r--r--vespajlib/src/test/java/com/yahoo/system/ProcessExecuterTestCase.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/vespajlib/src/test/java/com/yahoo/system/ProcessExecuterTestCase.java b/vespajlib/src/test/java/com/yahoo/system/ProcessExecuterTestCase.java
new file mode 100644
index 00000000000..2bf1d8c094a
--- /dev/null
+++ b/vespajlib/src/test/java/com/yahoo/system/ProcessExecuterTestCase.java
@@ -0,0 +1,23 @@
+// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.system;
+
+import com.yahoo.collections.Pair;
+import com.yahoo.io.IOUtils;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:bratseth@yahoo-inc.com">Jon Bratseth</a>
+ */
+public class ProcessExecuterTestCase extends junit.framework.TestCase {
+
+ public void testIt() throws IOException {
+ IOUtils.writeFile("tmp123.txt","hello\nworld",false);
+ ProcessExecuter exec=new ProcessExecuter();
+ assertEquals(new Pair<>(0, "hello\nworld"), exec.exec("cat tmp123.txt"));
+ assertEquals(new Pair<>(0, "hello\nworld"), exec.exec(new String[]{"cat", "tmp123.txt"}));
+ new File("tmp123.txt").delete();
+ }
+
+}