Mercurial > dive4elements > river
view gwt-client/src/test/java/test/AbstractBerechnungsartenTester.java @ 9691:4311db5dacc8
Nachtrag Datenkorb Bezugswasserstände anzeigen
author | dnt_bjoernsen <d.tironi@bjoernsen.de> |
---|---|
date | Tue, 19 Jan 2021 14:59:32 +0100 |
parents | 531a60b7af95 |
children |
line wrap: on
line source
/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde * Software engineering by * Björnsen Beratende Ingenieure GmbH * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt * * This file is Free Software under the GNU AGPL (>=v3) * and comes with ABSOLUTELY NO WARRANTY! Check out the * documentation coming with Dive4Elements River for details. */ package test; import java.io.File; import java.io.IOException; import java.util.Iterator; import org.apache.commons.io.FileUtils; import org.junit.AfterClass; import org.junit.BeforeClass; /** * @author Domenico Nardi Tironi * */ public abstract class AbstractBerechnungsartenTester { // for common Settings // protected static File testFolder; protected enum FileExportBehaviour { do_not_override, export_all, export_none; // do_not_override: file export is set individually (not overridden) // true: all test files created by running jUnit-Tests will be written to disk // false: no file will be exported }; public static enum River { Beispielfluss, Rhein, Elbe }; @BeforeClass public static final void createTempFolder() { // windows: C:\Users\USER_NAME\AppData\Local\Temp if (testFolder == null) { testFolder = new File(FileUtils.getTempDirectory(), "FlysTestFolder"); if (!testFolder.isDirectory()) testFolder.mkdir(); } } @AfterClass public static void deleteTempFolder() { testFolder = new File(FileUtils.getTempDirectory(), "FlysTestFolder"); if (testFolder.isDirectory() && testFolder.exists()) { try { final Iterator<File> test = FileUtils.iterateFiles(testFolder, null, true); if (!test.hasNext()) { FileUtils.deleteDirectory(testFolder); testFolder = null; } } catch (final IOException e) { e.printStackTrace(); } } } }