felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r1807592 - in /felix/trunk/utils/src/test: java/org/apache/felix/utils/properties/TypedPropertiesTest.java resources/typed2.properties resources/typed3.properties
Date Thu, 07 Sep 2017 11:31:48 GMT
Author: gnodet
Date: Thu Sep  7 11:31:48 2017
New Revision: 1807592

URL: http://svn.apache.org/viewvc?rev=1807592&view=rev
Log:
Add some tests for TypedProperties

Added:
    felix/trunk/utils/src/test/resources/typed2.properties
    felix/trunk/utils/src/test/resources/typed3.properties
Modified:
    felix/trunk/utils/src/test/java/org/apache/felix/utils/properties/TypedPropertiesTest.java

Modified: felix/trunk/utils/src/test/java/org/apache/felix/utils/properties/TypedPropertiesTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/utils/src/test/java/org/apache/felix/utils/properties/TypedPropertiesTest.java?rev=1807592&r1=1807591&r2=1807592&view=diff
==============================================================================
--- felix/trunk/utils/src/test/java/org/apache/felix/utils/properties/TypedPropertiesTest.java
(original)
+++ felix/trunk/utils/src/test/java/org/apache/felix/utils/properties/TypedPropertiesTest.java
Thu Sep  7 11:31:48 2017
@@ -76,4 +76,27 @@ public class TypedPropertiesTest extends
         assertEquals("test", p2.get("test"));
     }
 
+    public void testLoadTypedProps2() throws IOException
+    {
+        TypedProperties properties = new TypedProperties();
+        properties.load(this.getClass().getClassLoader().getResourceAsStream("typed2.properties"));
+        assertEquals("wlp3s0", properties.get("networkInterface"));
+    }
+
+    public void testLoadTypedProps3() throws IOException
+    {
+        TypedProperties properties = new TypedProperties();
+        properties.load(this.getClass().getClassLoader().getResourceAsStream("typed3.properties"));
+        assertEquals(21, properties.get("bla"));
+    }
+
+    public void testWriteTypedPropsFloat() throws IOException
+    {
+        TypedProperties properties = new TypedProperties();
+        properties.put("key", 400.333f);
+        StringWriter sw = new StringWriter();
+        properties.save(sw);
+        assertEquals("key = F\"1137191584\"\n", sw.toString());
+    }
+
 }

Added: felix/trunk/utils/src/test/resources/typed2.properties
URL: http://svn.apache.org/viewvc/felix/trunk/utils/src/test/resources/typed2.properties?rev=1807592&view=auto
==============================================================================
--- felix/trunk/utils/src/test/resources/typed2.properties (added)
+++ felix/trunk/utils/src/test/resources/typed2.properties Thu Sep  7 11:31:48 2017
@@ -0,0 +1,22 @@
+##---------------------------------------------------------------------------
+##  Licensed to the Apache Software Foundation (ASF) under one or more
+##  contributor license agreements.  See the NOTICE file distributed with
+##  this work for additional information regarding copyright ownership.
+##  The ASF licenses this file to You under the Apache License, Version 2.0
+##  (the "License"); you may not use this file except in compliance with
+##  the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+##  Unless required by applicable law or agreed to in writing, software
+##  distributed under the License is distributed on an "AS IS" BASIS,
+##  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+##  See the License for the specific language governing permissions and
+##  limitations under the License.
+##---------------------------------------------------------------------------
+#
+# typed.properties
+# Used in the TypedPropertiesTest
+#
+
+networkInterface="wlp3s0"

Added: felix/trunk/utils/src/test/resources/typed3.properties
URL: http://svn.apache.org/viewvc/felix/trunk/utils/src/test/resources/typed3.properties?rev=1807592&view=auto
==============================================================================
--- felix/trunk/utils/src/test/resources/typed3.properties (added)
+++ felix/trunk/utils/src/test/resources/typed3.properties Thu Sep  7 11:31:48 2017
@@ -0,0 +1,22 @@
+##---------------------------------------------------------------------------
+##  Licensed to the Apache Software Foundation (ASF) under one or more
+##  contributor license agreements.  See the NOTICE file distributed with
+##  this work for additional information regarding copyright ownership.
+##  The ASF licenses this file to You under the Apache License, Version 2.0
+##  (the "License"); you may not use this file except in compliance with
+##  the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+##  Unless required by applicable law or agreed to in writing, software
+##  distributed under the License is distributed on an "AS IS" BASIS,
+##  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+##  See the License for the specific language governing permissions and
+##  limitations under the License.
+##---------------------------------------------------------------------------
+#
+# typed.properties
+# Used in the TypedPropertiesTest
+#
+
+bla=i"21"



Mime
View raw message