DockerVolumeCommand extends DockerCommand { public DockerVolumeCommand(String subCommand) { super(VOLUME_COMMAND); this.subCommand = subCommand; super.addCommandArguments("sub-command", subCommand); } DockerVolumeCommand(String subCommand); DockerVolumeCommand setVolumeName(String volumeName); DockerVolumeCommand setDriverName(String driverName); String getVolumeName(); String getDriverName(); String getSubCommand(); DockerVolumeCommand setFormat(String format); static final String VOLUME_COMMAND; static final String VOLUME_CREATE_SUB_COMMAND; static final String VOLUME_LS_SUB_COMMAND; static final Pattern VOLUME_NAME_PATTERN; }
@Test public void testDockerVolumeCommand() { DockerVolumeCommand dockerVolumeCommand = new DockerVolumeCommand("create"); assertEquals("volume", dockerVolumeCommand.getCommandOption()); Assert.assertTrue( dockerVolumeCommand.getDockerCommandWithArguments().get("sub-command") .contains("create")); dockerVolumeCommand.setDriverName("driver1"); dockerVolumeCommand.setVolumeName("volume1"); Assert.assertTrue( dockerVolumeCommand.getDockerCommandWithArguments().get("driver") .contains("driver1")); Assert.assertTrue( dockerVolumeCommand.getDockerCommandWithArguments().get("volume") .contains("volume1")); }