1
- /*******************************************************************************
1
+ /*
2
2
* Licensed to the Apache Software Foundation (ASF) under one
3
3
* or more contributor license agreements. See the NOTICE file
4
4
* distributed with this work for additional information
15
15
* KIND, either express or implied. See the License for the
16
16
* specific language governing permissions and limitations
17
17
* 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 ;
20
24
21
25
import java .io .ByteArrayInputStream ;
22
26
import java .io .IOException ;
25
29
import java .util .Locale ;
26
30
import java .util .Properties ;
27
31
28
- import org .apache .ofbiz .base .test .GenericTestCaseBase ;
29
32
import org .apache .ofbiz .base .util .UtilProperties ;
33
+ import org .junit .Test ;
30
34
31
- public class UtilPropertiesTests extends GenericTestCaseBase {
35
+ public class UtilPropertiesTests {
32
36
33
37
private static final String country = "AU" ;
34
38
private static final String language = "en" ;
35
39
private final Locale locale = new Locale (language , country );
36
40
37
- public UtilPropertiesTests (String name ) {
38
- super (name );
39
- }
40
-
41
41
/**
42
42
* Old style xml:lang attribute value was of form en_AU. Test this
43
43
* format still works.
44
44
* @throws Exception
45
45
*/
46
+ @ Test
46
47
public void testReadXmlLangOldStyle () throws Exception {
47
48
Properties result = xmlToProperties ("_" );
48
49
assertNotNull (result );
@@ -56,13 +57,13 @@ public void testReadXmlLangOldStyle() throws Exception {
56
57
* Test it works.
57
58
* @throws Exception
58
59
*/
60
+ @ Test
59
61
public void testReadXmlLangNewStyle () throws Exception {
60
62
Properties result = xmlToProperties ("-" );
61
63
assertNotNull (result );
62
64
assertTrue (!result .isEmpty ());
63
65
assertEquals (1 , result .size ());
64
66
assertEquals ("Key Value" , result .getProperty ("PropertyKey" ));
65
-
66
67
}
67
68
68
69
private Properties xmlToProperties (String separator ) throws IOException {
@@ -75,8 +76,9 @@ private Properties xmlToProperties(String separator) throws IOException {
75
76
"\" >Key Value</value>\n " +
76
77
" </property>\n " +
77
78
"</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 );
80
82
}
81
83
}
82
84
}
0 commit comments