You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2021/11/15 15:28:31 UTC

[isis] branch master updated: ISIS-2894: add test for viewmodel implementing a generic property

This is an automated email from the ASF dual-hosted git repository.

ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git


The following commit(s) were added to refs/heads/master by this push:
     new 0cf4d27  ISIS-2894: add test for viewmodel implementing a generic property
0cf4d27 is described below

commit 0cf4d27e3a75a3b21e7e79beb20469a716ff5451
Author: Andi Huber <ah...@apache.org>
AuthorDate: Mon Nov 15 16:28:24 2021 +0100

    ISIS-2894: add test for viewmodel implementing a generic property
---
 .../DomainModelTest_usingGoodDomain.java           |  8 +++++
 .../testdomain/model/good/ProperGenericImpl.java   | 36 ++++++++++++++++++++++
 .../model/good/ProperGenericInterface.java         | 26 ++++++++++++++++
 3 files changed, 70 insertions(+)

diff --git a/regressiontests/stable-domainmodel/src/test/java/org/apache/isis/testdomain/domainmodel/DomainModelTest_usingGoodDomain.java b/regressiontests/stable-domainmodel/src/test/java/org/apache/isis/testdomain/domainmodel/DomainModelTest_usingGoodDomain.java
index 1b2565a..8bc9c91 100644
--- a/regressiontests/stable-domainmodel/src/test/java/org/apache/isis/testdomain/domainmodel/DomainModelTest_usingGoodDomain.java
+++ b/regressiontests/stable-domainmodel/src/test/java/org/apache/isis/testdomain/domainmodel/DomainModelTest_usingGoodDomain.java
@@ -71,6 +71,7 @@ import org.apache.isis.testdomain.model.good.ElementTypeInterface;
 import org.apache.isis.testdomain.model.good.ProperChoicesWhenChoicesFrom;
 import org.apache.isis.testdomain.model.good.ProperElementTypeVm;
 import org.apache.isis.testdomain.model.good.ProperFullyImpl;
+import org.apache.isis.testdomain.model.good.ProperGenericImpl;
 import org.apache.isis.testdomain.model.good.ProperInterface2;
 import org.apache.isis.testdomain.model.good.ProperMemberInheritanceInterface;
 import org.apache.isis.testdomain.model.good.ProperMemberInheritance_usingAbstract;
@@ -212,6 +213,13 @@ class DomainModelTest_usingGoodDomain {
         tester.assertLayout("layout");
     }
 
+    @Test
+    void genericInterface_whenImplemented_shouldBeSupported() {
+        val tester = testerFactory.propertyTester(ProperGenericImpl.class, "value");
+        tester.assertExists(true);
+        tester.assertValue("aValue");
+    }
+
     @ParameterizedTest
     @MethodSource("provideProperMemberInheritanceTypes")
     void titleAndIconName_shouldBeInheritable(final Class<?> type) throws Exception {
diff --git a/regressiontests/stable/src/main/java/org/apache/isis/testdomain/model/good/ProperGenericImpl.java b/regressiontests/stable/src/main/java/org/apache/isis/testdomain/model/good/ProperGenericImpl.java
new file mode 100644
index 0000000..6f79887
--- /dev/null
+++ b/regressiontests/stable/src/main/java/org/apache/isis/testdomain/model/good/ProperGenericImpl.java
@@ -0,0 +1,36 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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 org.apache.isis.testdomain.model.good;
+
+import org.apache.isis.applib.annotation.DomainObject;
+import org.apache.isis.applib.annotation.Nature;
+import org.apache.isis.applib.annotation.Property;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@DomainObject(nature = Nature.VIEW_MODEL)
+public class ProperGenericImpl
+implements ProperGenericInterface<String> {
+
+    @Property
+    @Getter @Setter
+    private String value = "aValue";
+
+}
diff --git a/regressiontests/stable/src/main/java/org/apache/isis/testdomain/model/good/ProperGenericInterface.java b/regressiontests/stable/src/main/java/org/apache/isis/testdomain/model/good/ProperGenericInterface.java
new file mode 100644
index 0000000..f4c397b
--- /dev/null
+++ b/regressiontests/stable/src/main/java/org/apache/isis/testdomain/model/good/ProperGenericInterface.java
@@ -0,0 +1,26 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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 org.apache.isis.testdomain.model.good;
+
+public interface ProperGenericInterface<T> {
+
+    T getValue();
+    void setValue(T prop);
+
+}