diff --git a/src/main/java/org/jd/core/v1/model/javasyntax/reference/ElementValueArrayInitializerElementValue.java b/src/main/java/org/jd/core/v1/model/javasyntax/reference/ElementValueArrayInitializerElementValue.java index ecd3a03..c46a4ae 100644 --- a/src/main/java/org/jd/core/v1/model/javasyntax/reference/ElementValueArrayInitializerElementValue.java +++ b/src/main/java/org/jd/core/v1/model/javasyntax/reference/ElementValueArrayInitializerElementValue.java @@ -11,7 +11,7 @@ public class ElementValueArrayInitializerElementValue implements BaseElementValu private final BaseElementValue elementValueArrayInitializer; public ElementValueArrayInitializerElementValue() { - this.elementValueArrayInitializer = null; + this(null); } public ElementValueArrayInitializerElementValue(BaseElementValue elementValueArrayInitializer) { diff --git a/src/test/java/org/jd/core/v1/model/javasyntax/reference/ElementValueArrayInitializerElementValueTest.java b/src/test/java/org/jd/core/v1/model/javasyntax/reference/ElementValueArrayInitializerElementValueTest.java new file mode 100644 index 0000000..bf469db --- /dev/null +++ b/src/test/java/org/jd/core/v1/model/javasyntax/reference/ElementValueArrayInitializerElementValueTest.java @@ -0,0 +1,31 @@ +package org.jd.core.v1.model.javasyntax.reference; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +public class ElementValueArrayInitializerElementValueTest { + + @Test + public void testElementValueArrayInitializerElementValue() { + // Arrange & Act + ElementValueArrayInitializerElementValue noArgsElementValue = new ElementValueArrayInitializerElementValue(); + + // Assert + assertNull(noArgsElementValue.getElementValueArrayInitializer()); + assertEquals("ElementValueArrayInitializerElementValue{null}", noArgsElementValue.toString()); + + // Act + ElementValueArrayInitializerElementValue elementValueArrayInitializerElementValue = new ElementValueArrayInitializerElementValue(); + + // Assert + assertNull(elementValueArrayInitializerElementValue.getElementValueArrayInitializer()); + assertEquals("ElementValueArrayInitializerElementValue{null}", elementValueArrayInitializerElementValue.toString()); + + // Act & Assert for visitor + TestReferenceVisitor visitor = new TestReferenceVisitor(); + elementValueArrayInitializerElementValue.accept(visitor); + assertEquals(1, visitor.getVisitElementValueArrayInitializerElementValueCount()); + } +}