diff src/test/java/de/intevation/lada/test/stamm/DeskriptorenTest.java @ 1243:b652f4c9b75c

Add automatic tests for DeskriptorService.
author Tom Gottfried <tom@intevation.de>
date Thu, 15 Dec 2016 16:16:32 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/test/java/de/intevation/lada/test/stamm/DeskriptorenTest.java	Thu Dec 15 16:16:32 2016 +0100
@@ -0,0 +1,53 @@
+/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU GPL (v>=3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out
+ * the documentation coming with IMIS-Labordaten-Application for details.
+ */
+package de.intevation.lada.test.stamm;
+
+import java.net.URL;
+import java.util.List;
+
+import javax.json.JsonObject;
+import javax.json.JsonObjectBuilder;
+
+import org.junit.Assert;
+
+import de.intevation.lada.Protocol;
+import de.intevation.lada.test.ServiceTest;
+
+public class DeskriptorenTest extends ServiceTest {
+    private JsonObject expectedById;
+    private JsonObject create;
+
+    /**
+     * @return The test protocol
+     */
+    public List<Protocol> getProtocol() {
+        return protocol;
+    }
+
+    @Override
+    public void init(
+        URL baseUrl,
+        List<Protocol> protocol
+    ) {
+        super.init(baseUrl, protocol);
+
+        // Prepare expected object
+        JsonObject content = readJsonResource("/datasets/dbUnit_deskriptor.json")
+            .getJsonArray("stammdaten.deskriptoren").getJsonObject(0);
+        JsonObjectBuilder builder = convertObject(content);
+        expectedById = builder.build();
+        Assert.assertNotNull(expectedById);
+    }
+
+    public final void execute() {
+        getAll("deskriptor", "rest/deskriptor");
+        getAll("deskriptor", "rest/deskriptor?layer=1");
+        getAll("deskriptor", "rest/deskriptor?layer=1&parents=1, 2");
+        getById("deskriptor", "rest/deskriptor/1000", expectedById);
+    }
+}
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)