@@ -0,0 +1,2075 @@
+package org.jboss.rhq.jon.mig.tests;%0A%0Aimport static org.junit.Assert.fail;%0A%0Aimport java.io.File;%0Aimport java.io.IOException;%0A%0Aimport org.jboss.rhq.jon.mig.CLIParameters;%0Aimport org.jboss.rhq.jon.mig.JONMig;%0Aimport org.junit.Ignore;%0Aimport org.junit.Test;%0A%0Aimport com.beust.jcommander.JCommander;%0Aimport com.beust.jcommander.ParameterException;%0A%0A%0A/**%0A * @author Romain PELISSE - %3Cbelaran@redhat.com%3E%0A *%0A */%0A@Ignore(%22To be updated.%22)%0Apublic class CLITests %7B%0A%0A%09@Test%0A%09public void missingPropertiesFiles() %7B%0A%09%09String%5B%5D argv = %7B%22-verbose%22, %222%22 %7D;%0A%09%09try %7B%0A%09%09%09new JCommander(new CLIParameters(), argv);%0A%09%09%7D catch ( ParameterException e) %7B%0A%09%09%09return;%0A%09%09%7D%0A%09%09fail(%22Missing properties files list did NOT trigger an exception.%22);%0A%09%7D%0A%09%0A%09@Test%0A%09public void notExistingPropsFile() throws IOException %7B%09%09%0A%09%09String%5B%5D argv = %7B%22-verbose%22, %222%22, CLIParameters.PROPERTIES_OPTION, %22/path/to/none/existing/file%22  %7D;%0A%09%09try %7B%0A%09%09%09new JCommander(new CLIParameters(), argv);%0A%09%09%7D catch ( ParameterException e) %7B%0A%09%09%09System.out.println(e.getMessage());%0A%09%09%09return;%0A%09%09%7D%0A%09%09fail(%22None existing file did NOT trigger an exception.%22);%0A%09%7D%0A%0A%09@Test%0A%09public void unreadablePropsFile() throws IOException %7B%09%09%0A%09%09File file = File.createTempFile(%22propertiesFilePropertiesFiles%22, %22.test.properties%22);%0A%09%09file.setReadable(false);%0A%09%09String%5B%5D argv = %7B%22-verbose%22, %222%22, CLIParameters.PROPERTIES_OPTION, file.getAbsoluteFile().toString()  %7D;%0A%09%09try %7B%0A%09%09%09new JCommander(new CLIParameters(), argv);%0A%09%09%7D catch ( ParameterException e) %7B%0A%09%09%09System.out.println(e.getMessage());%0A%09%09%09return;%0A%09%09%7D finally %7B%0A%09%09%09file.delete();%0A%09%09%7D%0A%09%09fail(%22Unreadable file failed did NOT trigger an exception%22);%0A%09%7D%0A%09%0A%09@Test%0A%09public void propertiesFilePropertiesFiles() throws IOException %7B%0A%09%09File file = File.createTempFile(%22propertiesFilePropertiesFiles%22, %22.test.properties%22);%0A%09%09%0A%09%09String%5B%5D argv = %7B%22-verbose%22, %222%22, CLIParameters.PROPERTIES_OPTION , file.getAbsoluteFile().toString() %7D;%0A%09%09try %7B%0A%09%09%09JONMig.main(argv);%0A%09%09%7D catch ( ParameterException e) %7B%0A%09%09%09fail(%22Existing and readable file triggered an exception.%22);%0A%09%09%7D finally %7B%0A%09%09%09file.delete();%0A%09%09%7D%09%09%0A%09%7D%0A%7D%0A%0A

Add unit test