Update to use environment variables for testing
This commit is contained in:
parent
7de2556d6b
commit
06f9a5f445
@ -5,33 +5,29 @@ import static org.junit.Assert.assertTrue;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.junit.runners.Parameterized;
|
|
||||||
|
|
||||||
@RunWith(Parameterized.class)
|
public class FileToBase64StringConversionUnitTest {
|
||||||
public class FileToBase64StringConversionTest {
|
|
||||||
|
|
||||||
private String inputFilePath;
|
private String inputFilePath = "";
|
||||||
private String outputFilePath;
|
private String outputFilePath = "";
|
||||||
|
|
||||||
public FileToBase64StringConversionTest(String inputFilePath, String outputFilePath) {
|
|
||||||
this.inputFilePath = inputFilePath;
|
|
||||||
this.outputFilePath = outputFilePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Parameterized.Parameters
|
|
||||||
public static Collection<String[]> parameters() {
|
|
||||||
return Arrays.asList(new String[][] { { "", "" } });
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
// file paths are from environment arguments:
|
||||||
|
// mvn test
|
||||||
|
// -Dtest=com.baeldung.fileToBase64StringConversion.FileToBase64StringConversionUnitTest
|
||||||
|
// -DinputFilePath="abc.png" -DoutFilePath="abc.png"
|
||||||
|
|
||||||
public void fileToBase64StringConversion() throws FileNotFoundException, IOException {
|
public void fileToBase64StringConversion() throws FileNotFoundException, IOException {
|
||||||
|
inputFilePath = System.getProperty("inputFilePath");
|
||||||
|
outputFilePath = System.getProperty("outputFilePath");
|
||||||
|
|
||||||
|
if (inputFilePath == null || outputFilePath == null)
|
||||||
|
return;
|
||||||
|
|
||||||
File outputFile = new File(outputFilePath);
|
File outputFile = new File(outputFilePath);
|
||||||
File inputFile = new File(inputFilePath);
|
File inputFile = new File(inputFilePath);
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user