public interface Expect extends Closeable
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes all resources associated with this instance.
|
MultiResult |
expect(long timeoutMs,
Matcher<?>... matcher)
Deprecated.
This method is deprecated and will be removed. Use
withTimeout(long, java.util.concurrent.TimeUnit) to change the timeout for the
expect operation. |
<R extends Result> |
expect(long timeoutMs,
Matcher<R> matcher)
Deprecated.
This method is deprecated and will be removed. Use
withTimeout(long, java.util.concurrent.TimeUnit) to change the timeout for the
expect operation. |
MultiResult |
expect(Matcher<?>... matchers)
Blocks until all the given matchers match against the first input stream using the default
timeout.
|
<R extends Result> |
expect(Matcher<R> matcher)
Blocks until the given matcher matches against the first input stream using the default
timeout.
|
MultiResult |
expectIn(int input,
long timeoutMs,
Matcher<?>... matchers)
Deprecated.
This method is deprecated and will be removed. Use
withTimeout(long, java.util.concurrent.TimeUnit) to change the timeout for the
expect operation. |
<R extends Result> |
expectIn(int input,
long timeoutMs,
Matcher<R> matcher)
Deprecated.
This method is deprecated and will be removed. Use
withTimeout(long, java.util.concurrent.TimeUnit) to change the timeout for the
expect operation. |
<R extends Result> |
expectIn(int input,
Matcher<R> matcher)
Blocks until the given matcher matches against the given input stream using the default
timeout.
|
InteractBuilder |
interact()
Starts the interactive loop for the first input.
|
InteractBuilder |
interactWith(int input)
Starts the interactive loop for the given input.
|
Expect |
send(String string)
Sends the string to the output stream and flushes the output.
|
Expect |
sendBytes(byte[] bytes)
Sends the given byte array and flushes the output.
|
Expect |
sendLine()
Sends a new line to the output.
|
Expect |
sendLine(String string)
Appends the line separator character to the string and calls
send(String) method. |
Expect |
withInfiniteTimeout()
Deprecated.
use
withTimeout(long, TimeUnit) with Long.MAX_VALUE, TimeUnit.DAYS
instead. |
Expect |
withTimeout(long duration,
TimeUnit unit)
Sets the default timeout in the given unit for the expect operations for the returned
instance.
|
Expect send(String string) throws IOException
charset set in the .ExpectBuilder.string - the string to be sentIOException - if I/O error occursExpect sendLine(String string) throws IOException
send(String) method.string - the string to be sentIOException - if I/O error occurssend(String),
ExpectBuilder.withLineSeparator(String)Expect sendLine() throws IOException
sendLine(String) method with
empty string as a
parameter.IOException - if I/O error occursExpect sendBytes(byte[] bytes) throws IOException
bytes - the bytes to be sentIOException - if I/O error occurs<R extends Result> R expect(Matcher<R> matcher) throws IOException
AssertionError if
ExpectBuilder.errorOnTimeout is set. Deprecated.
An instance of EOFException will be thrown if the underlying input steam,
the internal buffer
is empty and the match operation is not successful.R - the matcher typematcher - the matherExpectIOException - if the matcher does not match and the
the ExpectBuilder.withExceptionOnFailure() flag was setClosedByInterruptException - if the thread calling this method has
been interruptedIOException - if an I/O error occursMultiResult expect(Matcher<?>... matchers) throws IOException
AssertionError if
ExpectBuilder.errorOnTimeout is set. Deprecated.
An instance of EOFException will be thrown if the underlying input steam,
the internal buffer
is empty and the match operation is not successful.matchers - the matchersExpectIOException - if the matcher does not match and the
the ExpectBuilder.withExceptionOnFailure() flag was setClosedByInterruptException - if the thread calling this method has
been interruptedIOException - if an I/O error occurs@Deprecated <R extends Result> R expect(long timeoutMs, Matcher<R> matcher) throws IOException
withTimeout(long, java.util.concurrent.TimeUnit) to change the timeout for the
expect operation.AssertionError if
ExpectBuilder.errorOnTimeout is set. Deprecated.
An instance of EOFException will be thrown if the underlying input stream,
the internal buffer
is empty and the match operation is not successful.R - the matcher typetimeoutMs - the timeout for the expect operation in milliseconds,
infinite if -1 is passedmatcher - the matherExpectIOException - if the matcher does not match and the
the ExpectBuilder.withExceptionOnFailure() flag was setClosedByInterruptException - if the thread calling this method has
been interruptedIOException - if an I/O error occurs@Deprecated MultiResult expect(long timeoutMs, Matcher<?>... matcher) throws IOException
withTimeout(long, java.util.concurrent.TimeUnit) to change the timeout for the
expect operation.AssertionError if
ExpectBuilder.errorOnTimeout is set. Deprecated.
An instance of EOFException will be thrown if the underlying input steam,
the internal buffer
is empty and the match operation is not successful.timeoutMs - the timeout for the expect operation in milliseconds,
infinite if -1 is passedmatcher - the matchersExpectIOException - if the matcher does not match and the
the ExpectBuilder.withExceptionOnFailure() flag was setClosedByInterruptException - if the thread calling this method has
been interruptedIOException - if an I/O error occurs<R extends Result> R expectIn(int input, Matcher<R> matcher) throws IOException
AssertionError if
ExpectBuilder.errorOnTimeout is set. Deprecated.
An instance of EOFException will be thrown if the underlying input steam,
the internal buffer
is empty and the match operation is not successful.R - the matcher typeinput - the index of the input. if the index is outside of the boundaries,
a runtime exception will be
thrownmatcher - the matcherExpectIOException - if the matcher does not match and the
the ExpectBuilder.withExceptionOnFailure() flag was setClosedByInterruptException - if the thread calling this method has
been interruptedIOException - if an I/O error occurs@Deprecated <R extends Result> R expectIn(int input, long timeoutMs, Matcher<R> matcher) throws IOException
withTimeout(long, java.util.concurrent.TimeUnit) to change the timeout for the
expect operation.AssertionError if
ExpectBuilder.errorOnTimeout is set. Deprecated.R - the matcher typeinput - the index of the input. if the index is outside of the boundaries,
a runtime exception will be
throwntimeoutMs - the timeout for the expect operation in milliseconds,
infinite if -1 is passedmatcher - the matherExpectIOException - if the matcher does not match and the
the ExpectBuilder.withExceptionOnFailure() flag was setClosedByInterruptException - if the thread calling this method has
been interruptedIOException - if an I/O error occurs@Deprecated MultiResult expectIn(int input, long timeoutMs, Matcher<?>... matchers) throws IOException
withTimeout(long, java.util.concurrent.TimeUnit) to change the timeout for the
expect operation.AssertionError if
ExpectBuilder.errorOnTimeout is set. Deprecated.
An instance of EOFException will be thrown if the underlying input steam,
the internal buffer
is empty and the match operation is not successful.input - the index of the input. if the index is outside of the boundaries,
a runtime exception will be
throwntimeoutMs - the timeout for the expect operation in milliseconds,
infinite if -1 is passedmatchers - the matchersExpectIOException - if the matcher does not match and the
the ExpectBuilder.withExceptionOnFailure() flag was setClosedByInterruptException - if the thread calling this method has
been interruptedIOException - if an I/O error occursExpect withTimeout(long duration, TimeUnit unit)
duration - the timeout valueunit - the time unitIllegalArgumentException - if the timeout <= 0@Deprecated Expect withInfiniteTimeout()
withTimeout(long, TimeUnit) with Long.MAX_VALUE, TimeUnit.DAYS
instead.void close()
throws IOException
close in interface AutoCloseableclose in interface CloseableIOException - if I/O error occursInteractBuilder interact()
InteractBuilder interactWith(int input)
input - the index of the input stream to use for the interact loop.Copyright © 2014–2018 Alexey Gavrilov and contributors. All rights reserved.