diff gwt-client/src/test/java/test/uinfo/UInfoBerechnungsartenTester.java @ 9567:86e522bc7f36

jUnit-Tests completed
author gernotbelger
date Mon, 05 Nov 2018 13:21:57 +0100
parents 173f188569c6
children 531a60b7af95
line wrap: on
line diff
--- a/gwt-client/src/test/java/test/uinfo/UInfoBerechnungsartenTester.java	Mon Nov 05 10:19:12 2018 +0100
+++ b/gwt-client/src/test/java/test/uinfo/UInfoBerechnungsartenTester.java	Mon Nov 05 13:21:57 2018 +0100
@@ -10,12 +10,15 @@
 import org.junit.Test;
 
 import test.AbstractBerechnungsartenTester;
+import test.FilenameSupplier;
 import test.ICalcMode;
-import test.IFilenameMapper;
 
 @Ignore
 public class UInfoBerechnungsartenTester extends AbstractBerechnungsartenTester {
 
+    private final String UINFO_SALIX_MAIN_EXPORT_MODE_NAME = "uinfo_salix_line_export";
+    private final String UINFO_SALIX_LAENGS_CHART_NAME = "uinfo_salix_line";
+
     public static enum CalcMode implements ICalcMode {
         uinfo_salix_line, //
         // der Vollständigkeit halber
@@ -26,53 +29,103 @@
     // scenarioType.option1
     // scenarioType.option2
     // scenarioType.option3
-
-    public static enum FilenameMapper implements IFilenameMapper {
-
-        SALIX_NO_SCENARIO("/uinfo/salix/salix_no_scenario.csv"), //
-        SALIX_REGIONAL_SCENARIO("/uinfo/salix/salix_regional.csv"), //
-        SALIX_SUPRAREGIONAL_SCENARIO("/uinfo/salix/salix_supraregional.csv"), //
-        SALIX_HISTORICAL_SCENARIO("/uinfo/salix/salix_historical.csv"); //
-        private final String filename;
+    /*
+     * HELLO WORLD FILES:
+     * FilenameSupplier SALIX_NO_SCENARIO = new FilenameSupplier("/uinfo/salix/salix_no_scenario.csv"); //
+     * FilenameSupplier SALIX_REGIONAL_SCENARIO = new FilenameSupplier("/uinfo/salix/salix_regional.csv"); //
+     * FilenameSupplier SALIX_SUPRAREGIONAL_SCENARIO = new FilenameSupplier("/uinfo/salix/salix_supraregional.csv"); //
+     * FilenameSupplier SALIX_HISTORICAL_SCENARIO = new FilenameSupplier("/uinfo/salix/salix_historical.csv"); //
+     */
 
-        FilenameMapper(final String filename) {
-            this.filename = filename;
-        }
+    FilenameSupplier SALIX_01 = new FilenameSupplier("/uinfo/salix/uinfo_salix_01.csv"); //
+    FilenameSupplier SALIX_02 = new FilenameSupplier("/uinfo/salix/uinfo_salix_02.csv"); //
+    FilenameSupplier SALIX_02_CHART = new FilenameSupplier("/uinfo/salix/uinfo_salix_02_chart_laengs.csv"); //
+    FilenameSupplier SALIX_03 = new FilenameSupplier("/uinfo/salix/uinfo_salix_03.csv"); //
+    FilenameSupplier SALIX_03_CHART = new FilenameSupplier("/uinfo/salix/uinfo_salix_03_chart_laengs.csv"); //
+    FilenameSupplier SALIX_04 = new FilenameSupplier("/uinfo/salix/uinfo_salix_04.csv"); //
 
-        @Override
-        public String getFilename() {
-            return this.filename;
-        }
-    }
-
-    /* Salix no Scenario */
     @Test
-    public void testSalixNoScenario() throws ServerException, IOException {
-        new UinfoSalixRunner(FilenameMapper.SALIX_NO_SCENARIO, 0., 182.4, River.Beispielfluss, null)
-                .runTest(overrideFileExport() != null ? overrideFileExport() : true);
+    public void test01() throws ServerException, IOException {
+        new UinfoSalixRunner(336.2, 866.3, River.Rhein, null) //
+                .addOutputTest(this.SALIX_01, this.UINFO_SALIX_MAIN_EXPORT_MODE_NAME, null) //
+                .runTest();
+        // this.SALIX_NO_SCENARIO
     }
 
     @Test
-    public void testSalixRegionalScenario() throws ServerException, IOException {
-        new UinfoSalixRegionalRunner(FilenameMapper.SALIX_REGIONAL_SCENARIO, 0., 182.4, River.Beispielfluss, "scenarioType.option1", 50., 60., "5 -10 12 0")
-                .runTest(overrideFileExport() != null ? overrideFileExport() : true);
+    public void test02() throws ServerException, IOException {
+        new UinfoSalixRegionalRunner(336.2, 866.3, River.Rhein, "scenarioType.option1", 336.2, 866.3, "-50 50")//
+                .addOutputTest(this.SALIX_02, this.UINFO_SALIX_MAIN_EXPORT_MODE_NAME, null) //
+                .addOutputTest(this.SALIX_02_CHART, this.UINFO_SALIX_LAENGS_CHART_NAME, null) //
+                .runTest();
+        // this.SALIX_REGIONAL_SCENARIO,
     }
 
     @Test
-    public void testSalixSupraregionalScenario() throws ServerException, IOException {
+    public void test03() throws ServerException, IOException {
         final List<SalixZone> zones = new ArrayList<SalixZone>();
-        zones.add(SalixZone.createFromTableEntry("2", "0", "50"));
-        zones.add(SalixZone.createFromTableEntry("5", "50", "100"));
-        zones.add(SalixZone.createFromTableEntry("2", "100", "182.4"));
-        new UinfoSalixSupraregionalRunner(FilenameMapper.SALIX_SUPRAREGIONAL_SCENARIO, 0., 182.4, River.Beispielfluss, "scenarioType.option2", zones)
-                .runTest(overrideFileExport() != null ? overrideFileExport() : true);
+        zones.add(SalixZone.createFromTableEntry("0", "0", "100"));
+        zones.add(SalixZone.createFromTableEntry("-50", "100", "200"));
+        zones.add(SalixZone.createFromTableEntry("0", "200", "300"));
+        zones.add(SalixZone.createFromTableEntry("30", "300", "450"));
+        zones.add(SalixZone.createFromTableEntry("0", "450", "550"));
+
+        new UinfoSalixSupraregionalRunner(0., 550.0, River.Elbe, "scenarioType.option2", zones)
+                .addOutputTest(this.SALIX_03, this.UINFO_SALIX_MAIN_EXPORT_MODE_NAME, null) //
+                .addOutputTest(this.SALIX_03_CHART, this.UINFO_SALIX_LAENGS_CHART_NAME, null) //
+                .runTest();
+        // this.SALIX_SUPRAREGIONAL_SCENARIO,
     }
 
     @Test
-    public void testSalixHistoricalScenario() throws ServerException, IOException {
-
+    public void test04() throws ServerException, IOException {
         // name of sounding can be found in ParameterMatrixPanel.getData
-        new UinfoSalixHistoricalRunner(FilenameMapper.SALIX_HISTORICAL_SCENARIO, 0., 182.4, River.Beispielfluss, "scenarioType.option3", "single-18", 149.6,
-                182.4).runTest(overrideFileExport() != null ? overrideFileExport() : true);
+        new UinfoSalixHistoricalRunner(0., 598.3, River.Elbe, "scenarioType.option3", "single-68", 0.1, 585.3)
+                .addOutputTest(this.SALIX_04, this.UINFO_SALIX_MAIN_EXPORT_MODE_NAME, null) //
+                .runTest();
+        // this.SALIX_HISTORICAL_SCENARIO,
     }
+
+    /*
+     * HELLO
+     * WORLD (below)
+     */
+    /*
+     * /* Salix no Scenario
+     */
+    /*
+     * // @Test
+     * public void testSalixNoScenario() throws ServerException, IOException {
+     * new UinfoSalixRunner(0., 182.4, River.Beispielfluss, null) //
+     * .addOutputTest(this.SALIX_NO_SCENARIO, this.UINFO_SALIX_MAIN_EXPORT_MODE_NAME, null) //
+     * .runTest();
+     * // this.SALIX_NO_SCENARIO
+     * }
+     * // @Test
+     * public void testSalixRegionalScenario() throws ServerException, IOException {
+     * new UinfoSalixRegionalRunner(0., 182.4, River.Beispielfluss, "scenarioType.option1", 50., 60., "5 -10 12 0")
+     * .addOutputTest(this.SALIX_REGIONAL_SCENARIO, this.UINFO_SALIX_MAIN_EXPORT_MODE_NAME, null) //
+     * .runTest();
+     * // this.SALIX_REGIONAL_SCENARIO,
+     * }
+     * // @Test
+     * public void testSalixSupraregionalScenario() throws ServerException, IOException {
+     * final List<SalixZone> zones = new ArrayList<SalixZone>();
+     * zones.add(SalixZone.createFromTableEntry("2", "0", "50"));
+     * zones.add(SalixZone.createFromTableEntry("5", "50", "100"));
+     * zones.add(SalixZone.createFromTableEntry("2", "100", "182.4"));
+     * new UinfoSalixSupraregionalRunner(0., 182.4, River.Beispielfluss, "scenarioType.option2", zones)
+     * .addOutputTest(this.SALIX_SUPRAREGIONAL_SCENARIO, this.UINFO_SALIX_MAIN_EXPORT_MODE_NAME, null) //
+     * .runTest();
+     * // this.SALIX_SUPRAREGIONAL_SCENARIO,
+     * }
+     * // @Test
+     * public void testSalixHistoricalScenario() throws ServerException, IOException {
+     * // name of sounding can be found in ParameterMatrixPanel.getData
+     * new UinfoSalixHistoricalRunner(0., 182.4, River.Beispielfluss, "scenarioType.option3", "single-18", 149.6, 182.4)
+     * .addOutputTest(this.SALIX_HISTORICAL_SCENARIO, this.UINFO_SALIX_MAIN_EXPORT_MODE_NAME, null) //
+     * .runTest();
+     * // this.SALIX_HISTORICAL_SCENARIO,
+     * }
+     */
 }
\ No newline at end of file

http://dive4elements.wald.intevation.org