Sync old changes

This commit is contained in:
Oleg Agafonov 2019-03-22 21:51:26 +04:00
parent caf1a98759
commit 270ec615af
4 changed files with 35 additions and 17 deletions

View file

@ -25,6 +25,7 @@ import java.util.List;
public class ExportJsonGameplayDataTest {
private static final Logger logger = Logger.getLogger(ExportJsonGameplayDataTest.class);
private static final boolean MTGJSON_WRITE_TO_FILES = false;
@Test
@Ignore
@ -116,21 +117,24 @@ public class ExportJsonGameplayDataTest {
Gson gson = new GsonBuilder().setPrettyPrinting().create();
String filePath = System.getProperty("user.dir") + "/json/" + set.getCode() + ".json";
File outputFile = new File(filePath);
final boolean mkdirs = outputFile.getParentFile().mkdirs();
try (Writer writer =
new BufferedWriter(
new OutputStreamWriter(
new FileOutputStream(outputFile, false), StandardCharsets.UTF_8
)
)
) {
writer.write(gson.toJson(res));
System.out.println("Wrote " + set.getCode() + " to file");
} catch (Exception e) {
e.printStackTrace();
if (MTGJSON_WRITE_TO_FILES) {
String filePath = System.getProperty("user.dir") + "/json/" + set.getCode() + ".json";
File outputFile = new File(filePath);
final boolean mkdirs = outputFile.getParentFile().mkdirs();
try (Writer writer =
new BufferedWriter(
new OutputStreamWriter(
new FileOutputStream(outputFile, false), StandardCharsets.UTF_8
)
)
) {
writer.write(gson.toJson(res));
System.out.println("Wrote " + set.getCode() + " to file");
} catch (Exception e) {
e.printStackTrace();
}
} else {
//System.out.println(gson.toJson(res));
}
}
}