You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ad...@apache.org on 2012/05/05 11:53:16 UTC
svn commit: r1334370 -
/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/test/UtilPropertiesTests.java
Author: adrianc
Date: Sat May 5 09:53:16 2012
New Revision: 1334370
URL: http://svn.apache.org/viewvc?rev=1334370&view=rev
Log:
Added UTF-8 encoding to UtilPropertiesTests, simplified the code.
Modified:
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/test/UtilPropertiesTests.java
Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/test/UtilPropertiesTests.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/test/UtilPropertiesTests.java?rev=1334370&r1=1334369&r2=1334370&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/test/UtilPropertiesTests.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/test/UtilPropertiesTests.java Sat May 5 09:53:16 2012
@@ -21,7 +21,7 @@ package org.ofbiz.base.util.test;
import org.ofbiz.base.test.GenericTestCaseBase;
import org.ofbiz.base.util.UtilProperties;
-
+import java.nio.charset.Charset;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -30,25 +30,14 @@ import java.util.Properties;
public class UtilPropertiesTests extends GenericTestCaseBase {
- private Locale locale;
- private String country = "AU";
- private String language = "en";
+ private final String country = "AU";
+ private final String language = "en";
+ private final Locale locale = new Locale(language, country);
public UtilPropertiesTests(String name) {
super(name);
}
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- locale = new Locale(language, country);
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
/**
* Old style xml:lang attribute value was of form en_AU. Test this
* format still works.
@@ -77,7 +66,7 @@ public class UtilPropertiesTests extends
}
private Properties xmlToProperties(String separator) throws IOException {
- String xmlData = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
+ String xmlData = new String("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<resource xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
" xsi:noNamespaceSchemaLocation=\"http://ofbiz.apache.org/dtds/ofbiz-properties.xsd\">\n" +
" <property key=\"PropertyKey\">\n" +
@@ -85,10 +74,8 @@ public class UtilPropertiesTests extends
language + separator + country +
"\">Key Value</value>\n" +
" </property>\n" +
- "</resource>";
- InputStream in = new ByteArrayInputStream(xmlData.getBytes());
-
+ "</resource>");
+ InputStream in = new ByteArrayInputStream(new String(xmlData.getBytes(), Charset.forName("UTF-8")).getBytes());
return UtilProperties.xmlToProperties(in, locale, null);
}
-
}