Improves use of docker-java in unit tests by mfulgo · Pull Request #28 · docker-java/docker-java

added 4 commits

July 18, 2014 15:27
The field is never used in these tests. It should make it easier to
separate tests that require a docker.io account from those that do not.
Just doing a little refactoring of the constructor to make it easier to
read.
In order to improve the usability of DockerClient in tests, this
introduces a CommandFactory interface (and default implementation). The
interface can be injected into the DockerClient at construction,
allowing the use of a CommandFactory that returns mock or stub commands
for later test assertions.

I envision that the methods that create the commands from the
DockerClient itself could be deprecated: users of the library could
create the commands from the CommandFactory directly and simply pass
them into the DockerClient#execute method where teh baseResource and
(if appropriate) authConfig would be set on the command before it's
executed.

Issue docker-java#25
This only adds getters for fields that are of immutable types (Strings,
booleans, ints). For objects that take in Config objects, I'll look at
adding getters in a future commit. Ideally all of these things would be
immutable.

Issue docker-java#25