improve test coverage
diff --git a/src/main/java/org/yaml/snakeyaml/constructor/Constructor.java b/src/main/java/org/yaml/snakeyaml/constructor/Constructor.java
index 287de40..922cd79 100644
--- a/src/main/java/org/yaml/snakeyaml/constructor/Constructor.java
+++ b/src/main/java/org/yaml/snakeyaml/constructor/Constructor.java
@@ -337,7 +337,7 @@
         return (T[]) Array.newInstance(type.getComponentType(), 0);

     }

 

-    protected Property getProperty(Class<? extends Object> type, String name)

+    private Property getProperty(Class<? extends Object> type, String name)

             throws IntrospectionException {

         for (PropertyDescriptor property : Introspector.getBeanInfo(type).getPropertyDescriptors()) {

             if (property.getName().equals(name)) {

diff --git a/src/main/java/org/yaml/snakeyaml/representer/Representer.java b/src/main/java/org/yaml/snakeyaml/representer/Representer.java
index cf32873..0c97fad 100644
--- a/src/main/java/org/yaml/snakeyaml/representer/Representer.java
+++ b/src/main/java/org/yaml/snakeyaml/representer/Representer.java
@@ -91,7 +91,7 @@
         representedObjects.put(aliasKey, node);
         boolean bestStyle = true;
         for (Property property : properties) {
-            Node nodeKey = representData(property.getName());
+            ScalarNode nodeKey = (ScalarNode) representData(property.getName());
             Object memberValue = property.get(javaBean);
             Node nodeValue = representData(memberValue);
             if (nodeValue instanceof MappingNode) {
@@ -104,7 +104,7 @@
             } else if (memberValue != null && Enum.class.isAssignableFrom(memberValue.getClass())) {
                 nodeValue.setTag("tag:yaml.org,2002:str");
             }
-            if (!((nodeKey instanceof ScalarNode && ((ScalarNode) nodeKey).getStyle() == null))) {
+            if (nodeKey.getStyle() != null) {
                 bestStyle = false;
             }
             if (!((nodeValue instanceof ScalarNode && ((ScalarNode) nodeValue).getStyle() == null))) {
@@ -134,6 +134,9 @@
                 continue;
             properties.add(new FieldProperty(field));
         }
+        if (properties.isEmpty()) {
+            throw new YAMLException("No JavaBean properties found in " + type.getName());
+        }
         return properties;
     }
 }
diff --git a/src/test/java/org/yaml/snakeyaml/error/MarkedYAMLExceptionTest.java b/src/test/java/org/yaml/snakeyaml/error/MarkedYAMLExceptionTest.java
index 406140d..e982545 100644
--- a/src/test/java/org/yaml/snakeyaml/error/MarkedYAMLExceptionTest.java
+++ b/src/test/java/org/yaml/snakeyaml/error/MarkedYAMLExceptionTest.java
@@ -24,6 +24,19 @@
         assertTrue(exception.toString().contains("\"search\""));

     }

 

+    public void testToString3() {

+        MarkedYAMLException exception = new MarkedYAMLException("See http://www.google.com", null,

+                null, null, "Note1");

+        assertTrue(exception.toString().contains("Note1"));

+    }

+

+    public void testToString4() {

+        Mark mark = new Mark("search", 0, 0, 0, "*The first line.\nThe last line.", 0);

+        MarkedYAMLException exception = new MarkedYAMLException("See http://www.google.com", mark,

+                null, null, null);

+        assertTrue(exception.toString().contains("first line"));

+    }

+

     public void testGetters() {

         Mark mark = new Mark("search", 0, 0, 0, "*The first line.\nThe last line.", 0);

         MarkedYAMLException exception = new MarkedYAMLException("See http://www.google.com", mark,

@@ -33,5 +46,4 @@
         assertEquals("Error2 happened", exception.getProblem());

         assertEquals(mark, exception.getProblemMark());

     }

-

 }

diff --git a/src/test/java/org/yaml/snakeyaml/representer/RepresenterTest.java b/src/test/java/org/yaml/snakeyaml/representer/RepresenterTest.java
index af05036..74d6e53 100644
--- a/src/test/java/org/yaml/snakeyaml/representer/RepresenterTest.java
+++ b/src/test/java/org/yaml/snakeyaml/representer/RepresenterTest.java
@@ -128,4 +128,29 @@
             assertTrue(true);

         }

     }

+

+    public void testRepresenterEmptyBean() {

+        EmptyBean bean = new EmptyBean();

+        Yaml yaml = new Yaml();

+        try {

+            yaml.dump(bean);

+            fail("EmptyBean has empty representation.");

+        } catch (Exception e) {

+            assertEquals(

+                    "No JavaBean properties found in org.yaml.snakeyaml.representer.RepresenterTest$EmptyBean",

+                    e.getMessage());

+        }

+    }

+

+    public static class EmptyBean {

+        private int number;

+

+        public void process() {

+            number += 1;

+        }

+

+        public int obtain() {

+            return number;

+        }

+    }

 }