// Path: core/src/main/java/se/tfiskgul/mux2fs/CommandLineArguments.java
// public static class Strict extends Shared {
// 
// 	@Parameter(names = "--tempdir", description = "Temporary directory under which to mux files", required = true)
// 	private Path tempDir;
// 	@Parameter(names = "-o", description = "Options", required = false)
// 	private List<String> options;
// 	private ImmutableList<String> passThroughOptions;
// 	private ImmutableList<String> fuseOptions;
// 
// 	public Path getTempDir() {
// 		return tempDir;
// 	}
// 
// 	public void validate() {
// 		validateDirectoryExists(getSource());
// 		validateDirectoryExists(getTarget());
// 		File tmpDirfile = tempDir.toFile();
// 		if (!tmpDirfile.exists()) {
// 			boolean mkdirs = tmpDirfile.mkdirs();
// 			if (!mkdirs) {
// 				logger.warn("Unable to automatically create directory {}", tempDir);
// 			}
// 		}
// 		validateDirectoryExists(tempDir);
// 	}
// 
// 	@VisibleForTesting
// 	List<String> getPassThroughOptions() {
// 		return passThroughOptions;
// 	}
// 
// 	public List<String> getFuseOptions() {
// 		return fuseOptions;
// 	}
// }


import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import com.beust.jcommander.ParameterException;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import se.tfiskgul.mux2fs.CommandLineArguments.Strict;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.nio.file.FileSystem;
import java.nio.file.Path;
/*
MIT License

Copyright (c) 2017 Carl-Frederik Hallberg

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
 */
package se.tfiskgul.mux2fs;






@SuppressFBWarnings({ "DMI_HARDCODED_ABSOLUTE_FILENAME", "RV_RETURN_VALUE_IGNORED_BAD_PRACTICE" })
public class ParseCommandLineTest extends Fixture {

	@Rule
	public ExpectedException exception = ExpectedException.none();
	private FileSystem fileSystem;
	private CommandLineArguments commandLineArguments;
	private Path root;
	private Path tmp;

	@Before
	public void before() {
		fileSystem = mockFileSystem();
		root = mockPath("/", fileSystem);
		tmp = mockDir(root, "tmp");
		commandLineArguments = new CommandLineArguments(fileSystem);
	}

	@Test
	public void testNoParametersParseFails() {
		exception.expect(ParameterException.class);
		commandLineArguments.parse(array());
	}

	@Test
	public void testParseMandatory() {
		Path target = mockDir(tmp, "target");
		Path source = mockDir(tmp, "source");
		Path tmpDir = mockDir(tmp, "dir");
// Path: core/src/main/java/se/tfiskgul/mux2fs/CommandLineArguments.java
// public static class Strict extends Shared {
// 
// 	@Parameter(names = "--tempdir", description = "Temporary directory under which to mux files", required = true)
// 	private Path tempDir;
// 	@Parameter(names = "-o", description = "Options", required = false)
// 	private List<String> options;
// 	private ImmutableList<String> passThroughOptions;
// 	private ImmutableList<String> fuseOptions;
// 
// 	public Path getTempDir() {
// 		return tempDir;
// 	}
// 
// 	public void validate() {
// 		validateDirectoryExists(getSource());
// 		validateDirectoryExists(getTarget());
// 		File tmpDirfile = tempDir.toFile();
// 		if (!tmpDirfile.exists()) {
// 			boolean mkdirs = tmpDirfile.mkdirs();
// 			if (!mkdirs) {
// 				logger.warn("Unable to automatically create directory {}", tempDir);
// 			}
// 		}
// 		validateDirectoryExists(tempDir);
// 	}
// 
// 	@VisibleForTesting
// 	List<String> getPassThroughOptions() {
// 		return passThroughOptions;
// 	}
// 
// 	public List<String> getFuseOptions() {
// 		return fuseOptions;
// 	}
// }


// Path: core/src/test/java/se/tfiskgul/mux2fs/ParseCommandLineTest.java
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import com.beust.jcommander.ParameterException;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import se.tfiskgul.mux2fs.CommandLineArguments.Strict;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.nio.file.FileSystem;
import java.nio.file.Path;

/*
MIT License

Copyright (c) 2017 Carl-Frederik Hallberg

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
 */
package se.tfiskgul.mux2fs;






@SuppressFBWarnings({ "DMI_HARDCODED_ABSOLUTE_FILENAME", "RV_RETURN_VALUE_IGNORED_BAD_PRACTICE" })
public class ParseCommandLineTest extends Fixture {

	@Rule
	public ExpectedException exception = ExpectedException.none();
	private FileSystem fileSystem;
	private CommandLineArguments commandLineArguments;
	private Path root;
	private Path tmp;

	@Before
	public void before() {
		fileSystem = mockFileSystem();
		root = mockPath("/", fileSystem);
		tmp = mockDir(root, "tmp");
		commandLineArguments = new CommandLineArguments(fileSystem);
	}

	@Test
	public void testNoParametersParseFails() {
		exception.expect(ParameterException.class);
		commandLineArguments.parse(array());
	}

	@Test
	public void testParseMandatory() {
		Path target = mockDir(tmp, "target");
		Path source = mockDir(tmp, "source");
		Path tmpDir = mockDir(tmp, "dir");
		Strict result = commandLineArguments.parse(array("--target", "/tmp/target", "--source", "/tmp/source", "--tempdir", "/tmp/dir"));