use of com.synopsys.integration.alert.test.common.TestPropertyKey in project hub-alert by blackducksoftware.
the class TestPropertiesFileGenerator method generatePropertiesFile.
@Test
@Disabled("This test is to generate the test.properties for new developers.")
public void generatePropertiesFile() throws IOException {
Path propertiesFilePath = TestResourceUtils.createTestPropertiesCanonicalFilePath();
System.out.println("Generating file: " + propertiesFilePath + "..");
File testPropertiesFile = propertiesFilePath.toFile();
if (!testPropertiesFile.exists()) {
boolean successfullyCreated = testPropertiesFile.createNewFile();
if (!successfullyCreated) {
System.out.println("There was a problem creating the file '" + propertiesFilePath + "'.");
return;
}
StringBuilder dataBuilder = new StringBuilder();
for (TestPropertyKey propertyKey : TestPropertyKey.values()) {
dataBuilder.append(propertyKey.getPropertyKey());
dataBuilder.append('=');
dataBuilder.append(System.lineSeparator());
}
FileUtils.write(testPropertiesFile, dataBuilder.toString(), Charset.defaultCharset(), false);
} else {
System.out.println("The file '" + propertiesFilePath + "' already exists, please rename or back it up.");
}
}
Aggregations