jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r156029 - incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/BinaryPropertyTest.java
Date Thu, 03 Mar 2005 10:39:39 GMT
Author: mreutegg
Date: Thu Mar  3 02:39:37 2005
New Revision: 156029

URL: http://svn.apache.org/viewcvs?view=rev&rev=156029
Log:
Removed test case that checked BinaryValue.getString(). Latest spec states that behaviour
is unspecified if Stream contains invalid UTF-8 byte sequence. Thus, not testable.

Modified:
    incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/BinaryPropertyTest.java

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/BinaryPropertyTest.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/BinaryPropertyTest.java?view=diff&r1=156028&r2=156029
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/BinaryPropertyTest.java
(original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/BinaryPropertyTest.java
Thu Mar  3 02:39:37 2005
@@ -23,7 +23,6 @@
 import javax.jcr.RepositoryException;
 import javax.jcr.ValueFormatException;
 import java.io.InputStream;
-import java.io.BufferedInputStream;
 import java.io.IOException;
 
 /**
@@ -103,39 +102,6 @@
         }
         assertEquals("Value.getStream() and Property.getStream() " +
                 "return different values.", -1, in2.read());
-    }
-
-    /**
-     * Tests the conversion from a Binary value to a String value and tests
-     * that the received string is encoded in UTF-8.
-     */
-    public void testGetString() throws NotExecutableException, RepositoryException, IOException
{
-        BufferedInputStream in = null;
-        try {
-            Value val = PropertyUtil.getValue(prop);
-            Value otherVal = prop.getValue();
-            in = new BufferedInputStream(val.getStream());
-            String str = otherVal.getString();
-            // read the stream into a byte array and compare the result
-            // of getString with that array.
-            // hopefully the binary property is not too long
-            byte[] utf8bytes = str.getBytes(UTF8);
-            byte b[] = new byte[1];
-            int i = 0;
-            while (in.read(b) != -1) {
-                assertEquals("The string received with Value.getString() " +
-                        "on a Stream value is not utf-8 encoded.", b[0], utf8bytes[i]);
-                i++;
-            }
-        } catch (ValueFormatException e) {
-            // throwing a ValueFormatException is permitted when the stream
-            // cannot be turned into a proper UTF-8 string
-            throw new NotExecutableException("Binary property value cannot be converted to
a String");
-        } finally {
-            if (in != null) {
-                in.close();
-            }
-        }
     }
 
     /**



Mime
View raw message