Package com.jcabi.ssh
Class Shell.Fake
- java.lang.Object
-
- com.jcabi.ssh.Shell.Fake
-
- All Implemented Interfaces:
Shell
- Enclosing interface:
- Shell
@Immutable public static final class Shell.Fake extends Object implements Shell
Fake shell for unit testing.It doesn't do anything, but imitates the behavior of a real shell, returning the code and the output provided in the ctor.
- Since:
- 1.6
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.jcabi.ssh.Shell
Shell.Empty, Shell.Fake, Shell.Plain, Shell.Safe, Shell.Verbose
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
exec(String command, InputStream stdin, OutputStream sout, OutputStream serr)
Execute and return exit code.
-
-
-
Constructor Detail
-
Fake
public Fake()
Ctor.
-
Fake
public Fake(int exit, String out, String err)
Ctor.- Parameters:
exit
- Exit code to returnout
- Stdout to returnerr
- Stderr to return
-
Fake
public Fake(int exit, byte[] out, byte[] err)
Ctor.- Parameters:
exit
- Exit code to returnout
- Stdout to returnerr
- Stderr to return
-
-
Method Detail
-
exec
public int exec(String command, InputStream stdin, OutputStream sout, OutputStream serr) throws IOException
Description copied from interface:Shell
Execute and return exit code.- Specified by:
exec
in interfaceShell
- Parameters:
command
- Commandstdin
- Stdin (will be closed)sout
- Stdout (will be closed)serr
- Stderr (will be closed)- Returns:
- Exit code
- Throws:
IOException
- If fails
-
-