[jboss-svn-commits] JBoss Common SVN: r4936 - common-core/trunk/src/test/java/org/jboss/test/util/test/propertyeditor.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Nov 28 03:18:03 EST 2012


Author: wolfc
Date: 2012-11-28 03:18:03 -0500 (Wed, 28 Nov 2012)
New Revision: 4936

Modified:
   common-core/trunk/src/test/java/org/jboss/test/util/test/propertyeditor/PropertyEditorsUnitTestCase.java
Log:
JBPAPP-8891: java.beans.PropertyEditorSupport#getAsText() differs between JDK 6 & 7. The first returns "" + null, the second plain null.

Modified: common-core/trunk/src/test/java/org/jboss/test/util/test/propertyeditor/PropertyEditorsUnitTestCase.java
===================================================================
--- common-core/trunk/src/test/java/org/jboss/test/util/test/propertyeditor/PropertyEditorsUnitTestCase.java	2012-08-16 04:30:07 UTC (rev 4935)
+++ common-core/trunk/src/test/java/org/jboss/test/util/test/propertyeditor/PropertyEditorsUnitTestCase.java	2012-11-28 08:18:03 UTC (rev 4936)
@@ -65,6 +65,7 @@
    private static Logger log = Logger.getLogger(PropertyEditorsUnitTestCase.class);
    Calendar calendar = Calendar.getInstance();
    private Locale locale;
+   private static final boolean hasJDK7;
 
    /** Augment the PropertyEditorManager search path to incorporate the JBoss
     specific editors. This simply references the PropertyEditors.class to
@@ -75,8 +76,27 @@
       PropertyEditors.init();
       String[] paths = PropertyEditorManager.getEditorSearchPath();
       log.info(Arrays.asList(paths));
+      hasJDK7 = hasClass("java.util.concurrent.ForkJoinPool");
    }
 
+   private static boolean hasClass(final String name)
+   {
+      try
+      {
+         Class.forName(name);
+         return true;
+      }
+      catch (ClassNotFoundException e)
+      {
+         return false;
+      }
+   }
+
+   private static boolean hasJDK7()
+   {
+      return hasJDK7;
+   }
+
    static class StringArrayComparator implements Comparator
    {
       public int compare(Object o1, Object o2)
@@ -216,7 +236,7 @@
       };
       // The expected string output from getAsText()
       String[][] expectedStringData = {
-         {"true", "false", "true", "false", "true", "false", "null"},
+         {"true", "false", "true", "false", "true", "false", hasJDK7() ? null : "null"},
          {"1", "-1", "0", "26"},
          {"1", "-1", "0", "160"},
          {"1", "-1", "0", "160"},



More information about the jboss-svn-commits mailing list