I just start using ExpectIt and I am having a problem with when the result doesn't match. I got the error message:
try {
//Init of the expect execution
Process process = Runtime.getRuntime().exec("/bin/sh");
Expect expect = new ExpectBuilder()
.withInputs(process.getInputStream())
.withOutput(process.getOutputStream())
.withTimeout(1, TimeUnit.SECONDS)
.withEchoInput(System.out)
.withEchoOutput(System.err)
.withExceptionOnFailure()
.build();
expect.sendLine("cd ..");
expect.sendLine("cd JPF_HOME/jpf-inspector/src/examples/mtmt/account");
expect.sendLine();
expect.sendLine("java -jar /Users/rodolfoadamshuksilva/NetBeansProjects/JPF_HOME/jpf-core/build/RunJPF.jar " + original.getName());
String list = expect.expect(regexp("\ncmd>")).getBefore();
expect.sendLine("enable ask scheduling cg");
expect.sendLine("run");
list = expect.expect(regexp("\nExecution is halted")).getBefore();
FileReader fr = new FileReader(record);
BufferedReader br = new BufferedReader(fr);
while (br.ready()) {
String srt = br.readLine();
if (srt.contains("choice_generators select")) {
expect.sendLine(srt);
list = expect.expect(regexp("\nExecution is halted")).getBefore();
}
}
expect.sendLine("exit");
list = expect.expect(regexp("\nterminated")).getBefore();
br.close();
fr.close();
expect.close();
process.destroy();