ExpectIt
ExpectIt copied to clipboard
Not correct Exception on expect operation
in class SingleInputExpect on method <R extends Result> R expect(long timeoutMs, Matcher<R> matcher) throws IOException on 105 line;
If copierFuture contains a thread with an exception (example SocketException) method return IOException with message Expect operation fails (timeout: 20000 ms) for matcher: contains('<-/MSG1>')].
But this message is not true.
maybe this solve problem: `
if (copierFuture == null) {
throw new IllegalStateException("Not started");
}
if (copierFuture.isCancelled()){
throw new IllegalStateException("Future is canceled");
}
try {
copierFuture.get();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} catch (ExecutionException e) {
try {
throw e.getCause();
} catch (IOException ioEx) {
throw ioEx;
} catch (Throwable throwable) {
throw new RuntimeException(throwable);
}
}
`
If you change your application code to log the exception object, not only the message, you will see the root cause of the IOException (ie Socket exception) thrown from the library, something like this:
Logger.error("Expect matching error", e);
I'm confused at what is not correct. I see <-/
and </
two different things in the 2nd screenshot.