You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2020/09/28 17:44:31 UTC
[commons-configuration] branch master updated: Sort members.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-configuration.git
The following commit(s) were added to refs/heads/master by this push:
new e13ba28 Sort members.
e13ba28 is described below
commit e13ba28d77de0de461a95f286b57d4811afddc13
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Sep 28 13:44:26 2020 -0400
Sort members.
---
.../configuration2/TestJSONConfiguration.java | 74 +++++++++++-----------
1 file changed, 37 insertions(+), 37 deletions(-)
diff --git a/src/test/java/org/apache/commons/configuration2/TestJSONConfiguration.java b/src/test/java/org/apache/commons/configuration2/TestJSONConfiguration.java
index 6b13a89..aee6905 100644
--- a/src/test/java/org/apache/commons/configuration2/TestJSONConfiguration.java
+++ b/src/test/java/org/apache/commons/configuration2/TestJSONConfiguration.java
@@ -53,9 +53,38 @@ public class TestJSONConfiguration
}
@Test
- public void testGetProperty_simple()
+ public void testCopyConstructor()
{
- assertEquals("value1", jsonConfiguration.getProperty("key1"));
+ final BaseHierarchicalConfiguration c = new BaseHierarchicalConfiguration();
+ c.addProperty("foo", "bar");
+
+ jsonConfiguration = new JSONConfiguration(c);
+ assertEquals("bar", jsonConfiguration.getString("foo"));
+ }
+
+ @Test
+ public void testGetProperty_dictionary()
+ {
+ assertEquals("Martin D'vloper",
+ jsonConfiguration.getProperty("martin.name"));
+ assertEquals("Developer", jsonConfiguration.getProperty("martin.job"));
+ assertEquals("Elite", jsonConfiguration.getProperty("martin.skill"));
+ }
+
+ @Test
+ public void testGetProperty_dictionaryInList()
+ {
+ assertEquals("UK", jsonConfiguration.getString("capitals(1).country"));
+ assertEquals("Washington", jsonConfiguration.getString("capitals(0).capital"));
+ }
+
+ @Test
+ public void testGetProperty_integer()
+ {
+ final Object property = jsonConfiguration.getProperty("int1");
+ assertTrue("property should be an Integer",
+ property instanceof Integer);
+ assertEquals(37, property);
}
@Test
@@ -72,6 +101,12 @@ public class TestJSONConfiguration
}
@Test
+ public void testGetProperty_simple()
+ {
+ assertEquals("value1", jsonConfiguration.getProperty("key1"));
+ }
+
+ @Test
public void testGetProperty_subset()
{
final Configuration subset = jsonConfiguration.subset("key4");
@@ -87,15 +122,6 @@ public class TestJSONConfiguration
}
@Test
- public void testGetProperty_integer()
- {
- final Object property = jsonConfiguration.getProperty("int1");
- assertTrue("property should be an Integer",
- property instanceof Integer);
- assertEquals(37, property);
- }
-
- @Test
public void testSave() throws IOException, ConfigurationException
{
// save the Configuration as a String...
@@ -124,30 +150,4 @@ public class TestJSONConfiguration
final Map<?, ?> capUk = (Map<?, ?>) capitals.get(1);
assertEquals("London", capUk.get("capital"));
}
-
- @Test
- public void testGetProperty_dictionary()
- {
- assertEquals("Martin D'vloper",
- jsonConfiguration.getProperty("martin.name"));
- assertEquals("Developer", jsonConfiguration.getProperty("martin.job"));
- assertEquals("Elite", jsonConfiguration.getProperty("martin.skill"));
- }
-
- @Test
- public void testGetProperty_dictionaryInList()
- {
- assertEquals("UK", jsonConfiguration.getString("capitals(1).country"));
- assertEquals("Washington", jsonConfiguration.getString("capitals(0).capital"));
- }
-
- @Test
- public void testCopyConstructor()
- {
- final BaseHierarchicalConfiguration c = new BaseHierarchicalConfiguration();
- c.addProperty("foo", "bar");
-
- jsonConfiguration = new JSONConfiguration(c);
- assertEquals("bar", jsonConfiguration.getString("foo"));
- }
}