Main { public static void main(String[] arguments) throws Exception { MainParameters mainParameters = _validate(arguments); DataPartitioningExporter dataPartitioningExporter = DataPartitioningExporterFactory.getDataPartitioningExporter(); ExportContext exportContext = mainParameters.toExportContext(); dataPartitioningExporter.export(exportContext); }  static void main(String[] arguments);  }
@Test(expected = IllegalArgumentException.class) public void testValidateEmptyArguments() throws Exception { Main.main(new String[0]); }
@Test(expected = ParameterException.class) public void testValidateInvalidCompanyId() throws Exception { Main.main( new String[] { "-C", "foo", "-O", "bar", "-P", "foo.properties", "-S", _SCHEMA_NAME }); }
@Test(expected = ParameterException.class) public void testValidateInvalidOptionArguments() throws Exception { Main.main(new String[] {"-X", "foo"}); }
@Test(expected = ParameterException.class) public void testValidateNonexistingOutputDirectory() throws Exception { Main.main( new String[] { "-C", _COMPANY_ID, "-O", "foo", "-P", "foo.properties", "-S", _SCHEMA_NAME }); }
@Test(expected = ParameterException.class) public void testValidateNonexistingPropertiesFile() throws Exception { Main.main( new String[] { "-C", _COMPANY_ID, "-O", "bar", "-P", "foo.properties", "-S", _SCHEMA_NAME }); }
@Test(expected = IllegalArgumentException.class) public void testValidateNullArguments() throws Exception { Main.main(null); }
@Test(expected = ParameterException.class) public void testValidateReadOnlyOutputDirectory() throws Exception { File readOnlyDir = temporaryFolder.newFolder(); readOnlyDir.setReadable(false); readOnlyDir.setWritable(false); Main.main( new String[] { "-C", _COMPANY_ID, "-O", readOnlyDir.getAbsolutePath(), "-P", "foo.properties", "-S", _SCHEMA_NAME }); }
@Test public void testValidateRequiredArguments() throws Exception { String[][] requiredArguments = { {"-C", ""}, {"-O", ""}, {"-P", ""}, {"-S", ""} }; for (String[] requiredArgument : requiredArguments) { try { Main.main(requiredArgument); } catch (ParameterException parameterException) { } } }