[Java container] Added some tests/logging/Javadoc and refactored for testability.