Skip to content

Commit 25f57ca

Browse files
author
Denys Zaiats
committed
[1.4.2-updated-unique-json-names] - fix for collecting results
1 parent f841298 commit 25f57ca

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/main/java/util/validator/ResponsiveUIValidator.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package util.validator;
22

3+
import http.helpers.Helper;
34
import org.apache.commons.io.FileUtils;
45
import org.apache.log4j.Logger;
56
import org.json.simple.JSONArray;
@@ -23,7 +24,6 @@
2324
import java.util.concurrent.atomic.AtomicLong;
2425

2526
import static environment.EnvironmentFactory.*;
26-
import static util.general.SystemHelper.isAutomotionFolderExists;
2727
import static util.general.SystemHelper.isRetinaDisplay;
2828
import static util.validator.Constants.*;
2929
import static util.validator.ResponsiveUIValidator.Units.PX;
@@ -202,15 +202,16 @@ public boolean validate() {
202202
}
203203

204204
long ms = System.currentTimeMillis();
205-
String jsonFileName = rootElementReadableName.replace(" ", "") + "-automotion" + ms + ".json";
205+
String uuid = Helper.getGeneratedStringWithLength(7);
206+
String jsonFileName = rootElementReadableName.replace(" ", "") + "-automotion" + ms + uuid + ".json";
206207
try (Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(TARGET_AUTOMOTION_JSON + jsonFileName), StandardCharsets.UTF_8))) {
207208
writer.write(jsonResults.toJSONString());
208209
} catch (IOException ex) {
209210
LOG.error("Cannot create json report: " + ex.getMessage());
210211
}
211212
jsonFiles.add(jsonFileName);
212213
try {
213-
File file = new File(TARGET_AUTOMOTION_JSON + rootElementReadableName.replace(" ", "") + "-automotion" + ms + ".json");
214+
File file = new File(TARGET_AUTOMOTION_JSON + rootElementReadableName.replace(" ", "") + "-automotion" + ms + uuid + ".json");
214215
if (file.getParentFile().mkdirs()) {
215216
if (file.createNewFile()) {
216217
BufferedWriter writer = new BufferedWriter(new FileWriter(file));

0 commit comments

Comments
 (0)