From 068ad00be9bd61b3c9fedcc771b162082ef1bd53 Mon Sep 17 00:00:00 2001
From: felmer <felmer>
Date: Wed, 4 May 2016 09:28:03 +0000
Subject: [PATCH] SSDM-3529: bug fixed and tested concerning toString() of
 FetchOptions with PropertyAssignments and with Vocabulary

SVN: 36477
---
 .../PropertyAssignmentFetchOptions.java       |  1 +
 .../ExperimentFetchOptionsTest.java           | 53 +++++++++++++++++++
 2 files changed, 54 insertions(+)
 create mode 100644 openbis_api/sourceTest/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/experiment/fetchoptions/ExperimentFetchOptionsTest.java

diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/property/fetchoptions/PropertyAssignmentFetchOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/property/fetchoptions/PropertyAssignmentFetchOptions.java
index 5dffe1ee00d..e654c1978c4 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/property/fetchoptions/PropertyAssignmentFetchOptions.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/property/fetchoptions/PropertyAssignmentFetchOptions.java
@@ -78,6 +78,7 @@ public class PropertyAssignmentFetchOptions extends FetchOptions<PropertyAssignm
     protected FetchOptionsToStringBuilder getFetchOptionsStringBuilder()
     {
         FetchOptionsToStringBuilder f = new FetchOptionsToStringBuilder("PropertyAssignment", this);
+        f.addFetchOption("Vocabulary", vocabulary);
         return f;
     }
 }
diff --git a/openbis_api/sourceTest/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/experiment/fetchoptions/ExperimentFetchOptionsTest.java b/openbis_api/sourceTest/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/experiment/fetchoptions/ExperimentFetchOptionsTest.java
new file mode 100644
index 00000000000..1e2d6bc30b2
--- /dev/null
+++ b/openbis_api/sourceTest/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/experiment/fetchoptions/ExperimentFetchOptionsTest.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2016 ETH Zuerich, SIS
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package ch.ethz.sis.openbis.generic.asapi.v3.dto.experiment.fetchoptions;
+
+import static org.testng.Assert.assertEquals;
+
+import org.testng.annotations.Test;
+
+/**
+ * 
+ *
+ * @author Franz-Josef Elmer
+ */
+public class ExperimentFetchOptionsTest
+{
+
+    @Test
+    public void testToString()
+    {
+        ExperimentFetchOptions fetchOptions = new ExperimentFetchOptions();
+        assertEquals(fetchOptions.toString(), "Experiment\n");
+        
+        fetchOptions.withType();
+        assertEquals(fetchOptions.toString(), "Experiment\n"
+                + "    with Type\n");
+        
+        fetchOptions.withType().withPropertyAssignments();
+        assertEquals(fetchOptions.toString(), "Experiment\n"
+                + "    with Type\n"
+                + "        with PropertyAssignments\n");
+        
+        fetchOptions.withType().withPropertyAssignments().withVocabulary();
+        assertEquals(fetchOptions.toString(), "Experiment\n"
+                + "    with Type\n"
+                + "        with PropertyAssignments\n"
+                + "            with Vocabulary\n");
+    }
+
+}
-- 
GitLab