Skip to content

Commit 0dede26

Browse files
committed
Improved: Turn ‘UtilPropertiesTests’ into a unit test class
(OFBIZ-11067) git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1859975 13f79535-47bb-0310-9956-ffa450edef68
1 parent 402db94 commit 0dede26

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

framework/base/src/main/java/org/apache/ofbiz/base/util/test/UtilPropertiesTests.java renamed to framework/base/src/test/java/org/apache/ofbiz/base/util/UtilPropertiesTests.java

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*******************************************************************************
1+
/*
22
* Licensed to the Apache Software Foundation (ASF) under one
33
* or more contributor license agreements. See the NOTICE file
44
* distributed with this work for additional information
@@ -15,8 +15,12 @@
1515
* KIND, either express or implied. See the License for the
1616
* specific language governing permissions and limitations
1717
* under the License.
18-
*******************************************************************************/
19-
package org.apache.ofbiz.base.util.test;
18+
*/
19+
package org.apache.ofbiz.base.util;
20+
21+
import static org.junit.Assert.assertEquals;
22+
import static org.junit.Assert.assertNotNull;
23+
import static org.junit.Assert.assertTrue;
2024

2125
import java.io.ByteArrayInputStream;
2226
import java.io.IOException;
@@ -25,24 +29,21 @@
2529
import java.util.Locale;
2630
import java.util.Properties;
2731

28-
import org.apache.ofbiz.base.test.GenericTestCaseBase;
2932
import org.apache.ofbiz.base.util.UtilProperties;
33+
import org.junit.Test;
3034

31-
public class UtilPropertiesTests extends GenericTestCaseBase {
35+
public class UtilPropertiesTests {
3236

3337
private static final String country = "AU";
3438
private static final String language = "en";
3539
private final Locale locale = new Locale(language, country);
3640

37-
public UtilPropertiesTests(String name) {
38-
super(name);
39-
}
40-
4141
/**
4242
* Old style xml:lang attribute value was of form en_AU. Test this
4343
* format still works.
4444
* @throws Exception
4545
*/
46+
@Test
4647
public void testReadXmlLangOldStyle() throws Exception {
4748
Properties result = xmlToProperties("_");
4849
assertNotNull(result);
@@ -56,13 +57,13 @@ public void testReadXmlLangOldStyle() throws Exception {
5657
* Test it works.
5758
* @throws Exception
5859
*/
60+
@Test
5961
public void testReadXmlLangNewStyle() throws Exception {
6062
Properties result = xmlToProperties("-");
6163
assertNotNull(result);
6264
assertTrue(!result.isEmpty());
6365
assertEquals(1, result.size());
6466
assertEquals("Key Value", result.getProperty("PropertyKey"));
65-
6667
}
6768

6869
private Properties xmlToProperties(String separator) throws IOException {
@@ -75,8 +76,9 @@ private Properties xmlToProperties(String separator) throws IOException {
7576
"\">Key Value</value>\n" +
7677
" </property>\n" +
7778
"</resource>";
78-
try (InputStream in = new ByteArrayInputStream(new String(xmlData.getBytes(), Charset.forName("UTF-8")).getBytes())) {
79-
return UtilProperties.xmlToProperties(in, locale, null);
79+
try (InputStream in = new ByteArrayInputStream(
80+
new String(xmlData.getBytes(), Charset.forName("UTF-8")).getBytes())) {
81+
return UtilProperties.xmlToProperties(in, locale, null);
8082
}
8183
}
8284
}

framework/base/testdef/basetests.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
<junit-test-suite class-name="org.apache.ofbiz.base.conversion.test.TestJSONConverters"/>
4242
<!--junit-test-suite class-name="org.apache.ofbiz.base.util.test.UtilIOTests"/-->
4343
<junit-test-suite class-name="org.apache.ofbiz.base.test.BaseUnitTests"/>
44-
<junit-test-suite class-name="org.apache.ofbiz.base.util.test.UtilPropertiesTests"/>
4544
<groovy-test-suite name="simple" location="component://base/groovyScripts/test/SimpleTests.groovy"/>
4645
</test-group>
4746
</test-suite>

0 commit comments

Comments
 (0)