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 2022/12/22 11:01:34 UTC

[isis] branch master updated: ISIS-3316: just comments

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 47f222c335 ISIS-3316: just comments
47f222c335 is described below

commit 47f222c33590b6508600a8b73d0720924fe33de4
Author: Andi Huber <ah...@apache.org>
AuthorDate: Thu Dec 22 12:01:28 2022 +0100

    ISIS-3316: just comments
---
 .../org/apache/causeway/commons/io/JaxbUtilsTest.java   | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/commons/src/test/java/org/apache/causeway/commons/io/JaxbUtilsTest.java b/commons/src/test/java/org/apache/causeway/commons/io/JaxbUtilsTest.java
index 6cdb3f6361..7243412394 100644
--- a/commons/src/test/java/org/apache/causeway/commons/io/JaxbUtilsTest.java
+++ b/commons/src/test/java/org/apache/causeway/commons/io/JaxbUtilsTest.java
@@ -18,6 +18,7 @@
  */
 package org.apache.causeway.commons.io;
 
+import javax.xml.bind.JAXBContext;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
@@ -39,7 +40,7 @@ class JaxbUtilsTest {
     @XmlType
     @XmlAccessorType(XmlAccessType.FIELD)
     @EqualsAndHashCode
-    public static class A {
+    static class A {
 
         @XmlElement(required = false)
         @Getter @Setter private B nested;
@@ -49,14 +50,19 @@ class JaxbUtilsTest {
     @XmlType
     @XmlAccessorType(XmlAccessType.FIELD)
     @EqualsAndHashCode
-    public static class B {
+    static class B {
 
         @XmlElement(required = false)
         @Getter @Setter private String string;
     }
 
-    /** Works for arbitrary {@link XmlRootElement#name()} combinations,
-     * except you cannot use the same {@code name="root"} say on both {@link A} and {@link B}. */
+    /**
+     * Works for arbitrary {@link XmlRootElement#name()} combinations,
+     * except you cannot use the same {@code name="root"} say on both {@link A} and {@link B}.
+     * <p>
+     * As {@link A} contains {@link B}, the {@link JAXBContext} for {@link A} should also bind type {@link B}.
+     * We are testing whether type-safe recovery especially for type {@link A} works as desired.
+     */
     @Test
     void typesafeUnmarshallingFromAmbiguousContext() {
 
@@ -66,13 +72,14 @@ class JaxbUtilsTest {
         val a = new A();
         a.setNested(b);
 
-        // when
+        // when ... doing a round trip
         val aXml = JaxbUtils.toStringUtf8(a);
         val bXml = JaxbUtils.toStringUtf8(b);
 
         val aRecovered = JaxbUtils.tryRead(A.class, aXml).ifFailureFail().ifAbsentFail().getValue().get();
         val bRecovered = JaxbUtils.tryRead(B.class, bXml).ifFailureFail().ifAbsentFail().getValue().get();
 
+        // then
         assertEquals(a, aRecovered);
         assertEquals(b, bRecovered);