Fix issue 156: setSkipMissingProperties fails for non-scalar values
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 4ef1709..92a40fa 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -7,6 +7,9 @@
     </properties>
     <body>
         <release version="1.11" date="in Mercurial" description="Maintenance">
+             <action dev="py4fun" type="fix"  issue="156">
+                Fix issue 156: setSkipMissingProperties fails for non-scalar values (2012-09-05)
+             </action>
              <action dev="py4fun" type="fix"  issue="155">
                 Fix issue 155: SnakeYAML must always eat its own food - a YAML document created by itself must
                 be read without exceptions (2012-09-04)
diff --git a/src/main/java/org/yaml/snakeyaml/constructor/Constructor.java b/src/main/java/org/yaml/snakeyaml/constructor/Constructor.java
index bef5125..1e5fcf6 100644
--- a/src/main/java/org/yaml/snakeyaml/constructor/Constructor.java
+++ b/src/main/java/org/yaml/snakeyaml/constructor/Constructor.java
@@ -269,7 +269,7 @@
                     if (!typeDetected && valueNode.getNodeId() != NodeId.scalar) {
                         // only if there is no explicit TypeDescription
                         Class<?>[] arguments = property.getActualTypeArguments();
-                        if (arguments != null) {
+                        if (arguments != null && arguments.length > 0) {
                             // type safe (generic) collection may contain the
                             // proper class
                             if (valueNode.getNodeId() == NodeId.sequence) {
diff --git a/src/test/java/org/yaml/snakeyaml/issues/issue154/MissingPropertyTest.java b/src/test/java/org/yaml/snakeyaml/issues/issue154/MissingPropertyTest.java
index 0d6b826..e618122 100644
--- a/src/test/java/org/yaml/snakeyaml/issues/issue154/MissingPropertyTest.java
+++ b/src/test/java/org/yaml/snakeyaml/issues/issue154/MissingPropertyTest.java
@@ -15,30 +15,25 @@
  */
 package org.yaml.snakeyaml.issues.issue154;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import junit.framework.TestCase;
 
-import org.junit.Before;
-import org.junit.Test;
 import org.yaml.snakeyaml.Yaml;
 import org.yaml.snakeyaml.constructor.Constructor;
 import org.yaml.snakeyaml.error.YAMLException;
 import org.yaml.snakeyaml.representer.Representer;
 
-public class MissingPropertyTest {
+public class MissingPropertyTest extends TestCase {
 
     private Yaml yaml;
 
-    @Before
-    public void init() {
+    public void setUp() {
         yaml = new Yaml();
     }
 
     /**
      * A normal scalar property should work fine.
      */
-    @Test
-    public void publicField() throws Exception {
+    public void testPublicField() throws Exception {
         String doc = "hello: 5";
         TestBean bean = yaml.loadAs(doc, TestBean.class);
         assertNotNull(bean);
@@ -48,10 +43,13 @@
     /**
      * By default, unknown fields should throw a YAMLException.
      */
-    @Test(expected = YAMLException.class)
-    public void unknownField() throws Exception {
-        String doc = "goodbye: 10";
-        yaml.loadAs(doc, TestBean.class);
+    public void testUnknownField() throws Exception {
+        try {
+            String doc = "goodbye: 10";
+            yaml.loadAs(doc, TestBean.class);
+        } catch (YAMLException e) {
+            assertTrue(e.getMessage().contains("Cannot create property=goodbye"));
+        }
     }
 
     /**
@@ -59,12 +57,11 @@
      * whether missing properties should throw a YAMLException (the default) or
      * simply show a warning. The default is false.
      */
-    @Test
-    public void skipMissingProperties() throws Exception {
+    public void testSkipMissingProperties() throws Exception {
         Representer representer = new Representer();
         representer.getPropertyUtils().setSkipMissingProperties(true);
         yaml = new Yaml(new Constructor(), representer);
-        String doc = "goodbye: 10\nhello: 5";
+        String doc = "goodbye: 10\nhello: 5\nfizz: [1]";
         TestBean bean = yaml.loadAs(doc, TestBean.class);
         assertNotNull(bean);
         assertEquals(5, bean.hello);
@@ -74,12 +71,15 @@
      * The default for setSkipMissingProperties(boolean) is false; this just
      * ensures it works if set manually.
      */
-    @Test(expected = YAMLException.class)
-    public void noSkipMissingProperties() throws Exception {
-        Representer representer = new Representer();
-        representer.getPropertyUtils().setSkipMissingProperties(false);
-        yaml = new Yaml(new Constructor(), representer);
-        String doc = "goodbye: 10";
-        yaml.loadAs(doc, TestBean.class);
+    public void testNoSkipMissingProperties() throws Exception {
+        try {
+            Representer representer = new Representer();
+            representer.getPropertyUtils().setSkipMissingProperties(false);
+            yaml = new Yaml(new Constructor(), representer);
+            String doc = "goodbye: 10";
+            yaml.loadAs(doc, TestBean.class);
+        } catch (YAMLException e) {
+            assertTrue(e.getMessage().contains("Cannot create property=goodbye"));
+        }
     }
 }