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 2018/09/27 22:24:26 UTC
svn commit: r1842194 [31/34] - in /commons/proper/configuration/trunk/src:
main/java/org/apache/commons/configuration2/
main/java/org/apache/commons/configuration2/beanutils/
main/java/org/apache/commons/configuration2/builder/
main/java/org/apache/com...
Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/sync/TestReadWriteSynchronizer.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/sync/TestReadWriteSynchronizer.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/sync/TestReadWriteSynchronizer.java (original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/sync/TestReadWriteSynchronizer.java Thu Sep 27 22:24:23 2018
@@ -41,12 +41,12 @@ public class TestReadWriteSynchronizer
@Test
public void testInitLock()
{
- ReadWriteLock lock = EasyMock.createMock(ReadWriteLock.class);
- Lock readLock = EasyMock.createMock(Lock.class);
+ final ReadWriteLock lock = EasyMock.createMock(ReadWriteLock.class);
+ final Lock readLock = EasyMock.createMock(Lock.class);
EasyMock.expect(lock.readLock()).andReturn(readLock);
readLock.lock();
EasyMock.replay(lock, readLock);
- ReadWriteSynchronizer sync = new ReadWriteSynchronizer(lock);
+ final ReadWriteSynchronizer sync = new ReadWriteSynchronizer(lock);
sync.beginRead();
EasyMock.verify(lock, readLock);
}
@@ -58,7 +58,7 @@ public class TestReadWriteSynchronizer
@Test
public void testReentrance()
{
- Synchronizer sync = new ReadWriteSynchronizer();
+ final Synchronizer sync = new ReadWriteSynchronizer();
sync.beginWrite();
sync.beginRead();
sync.beginRead();
@@ -82,20 +82,20 @@ public class TestReadWriteSynchronizer
final int readThreadCount = 3;
final int updateThreadCount = 2;
- Synchronizer sync = new ReadWriteSynchronizer();
- Account account1 = new Account();
- Account account2 = new Account();
+ final Synchronizer sync = new ReadWriteSynchronizer();
+ final Account account1 = new Account();
+ final Account account2 = new Account();
account1.change(TOTAL_MONEY / 2);
account2.change(TOTAL_MONEY / 2);
- UpdateThread[] updateThreads = new UpdateThread[updateThreadCount];
+ final UpdateThread[] updateThreads = new UpdateThread[updateThreadCount];
for (int i = 0; i < updateThreads.length; i++)
{
updateThreads[i] =
new UpdateThread(sync, numberOfUpdates, account1, account2);
updateThreads[i].start();
}
- ReaderThread[] readerThreads = new ReaderThread[readThreadCount];
+ final ReaderThread[] readerThreads = new ReaderThread[readThreadCount];
for (int i = 0; i < readerThreads.length; i++)
{
readerThreads[i] =
@@ -103,11 +103,11 @@ public class TestReadWriteSynchronizer
readerThreads[i].start();
}
- for (UpdateThread t : updateThreads)
+ for (final UpdateThread t : updateThreads)
{
t.join();
}
- for (ReaderThread t : readerThreads)
+ for (final ReaderThread t : readerThreads)
{
t.join();
assertEquals("Got read errors", 0, t.getErrors());
@@ -124,10 +124,10 @@ public class TestReadWriteSynchronizer
* @param accounts the accounts to check
* @return the sum of the money on these accounts
*/
- private static long sumUpAccounts(Account... accounts)
+ private static long sumUpAccounts(final Account... accounts)
{
long sum = 0;
- for (Account acc : accounts)
+ for (final Account acc : accounts)
{
sum += acc.getAmount();
}
@@ -157,7 +157,7 @@ public class TestReadWriteSynchronizer
*
* @param delta the delta
*/
- public void change(long delta)
+ public void change(final long delta)
{
amount += delta;
}
@@ -188,7 +188,7 @@ public class TestReadWriteSynchronizer
* @param readCount the number of read operations
* @param accs the accounts to monitor
*/
- public ReaderThread(Synchronizer s, int readCount, Account... accs)
+ public ReaderThread(final Synchronizer s, final int readCount, final Account... accs)
{
accounts = accs;
sync = s;
@@ -204,7 +204,7 @@ public class TestReadWriteSynchronizer
for (int i = 0; i < numberOfReads; i++)
{
sync.beginRead();
- long sum = sumUpAccounts(accounts);
+ final long sum = sumUpAccounts(accounts);
sync.endRead();
if (sum != TOTAL_MONEY)
{
@@ -255,8 +255,8 @@ public class TestReadWriteSynchronizer
* @param ac1 account 1
* @param ac2 account 2
*/
- public UpdateThread(Synchronizer s, int updateCount, Account ac1,
- Account ac2)
+ public UpdateThread(final Synchronizer s, final int updateCount, final Account ac1,
+ final Account ac2)
{
sync = s;
account1 = ac1;
@@ -286,7 +286,7 @@ public class TestReadWriteSynchronizer
acSource = account2;
acDest = account1;
}
- long x =
+ final long x =
Math.round(random.nextDouble()
* (acSource.getAmount() - 1)) + 1;
acSource.change(-x);
Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/test/HsqlDB.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/test/HsqlDB.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/test/HsqlDB.java (original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/test/HsqlDB.java Thu Sep 27 22:24:23 2018
@@ -39,7 +39,7 @@ public class HsqlDB
private Connection connection = null;
private static Log log = LogFactory.getLog(HsqlDB.class);
- public HsqlDB(String uri, String databaseDriver, String loadFile)
+ public HsqlDB(final String uri, final String databaseDriver, final String loadFile)
throws Exception
{
Class.forName(databaseDriver);
@@ -64,12 +64,12 @@ public class HsqlDB
{
connection.close();
}
- catch (Exception e)
+ catch (final Exception e)
{
}
}
- private void loadSqlFile(String fileName)
+ private void loadSqlFile(final String fileName)
throws Exception
{
Statement statement = null;
@@ -80,12 +80,12 @@ public class HsqlDB
for (int targetPos = commands.indexOf(';'); targetPos > -1; targetPos = commands.indexOf(';'))
{
- String cmd = commands.substring(0, targetPos + 1);
+ final String cmd = commands.substring(0, targetPos + 1);
try
{
statement.execute(cmd);
}
- catch (SQLException sqle)
+ catch (final SQLException sqle)
{
log.warn("Statement: " + cmd + ": " + sqle.getMessage());
}
@@ -102,13 +102,13 @@ public class HsqlDB
}
}
- private String getFileContents(String fileName)
+ private String getFileContents(final String fileName)
throws Exception
{
- FileReader fr = new FileReader(fileName);
+ final FileReader fr = new FileReader(fileName);
- char fileBuf[] = new char[1024];
- StringBuffer sb = new StringBuffer(1000);
+ final char fileBuf[] = new char[1024];
+ final StringBuffer sb = new StringBuffer(1000);
int res = -1;
while ((res = fr.read(fileBuf, 0, 1024)) > -1)
Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/tree/AbstractCombinerTest.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/tree/AbstractCombinerTest.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/tree/AbstractCombinerTest.java (original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/tree/AbstractCombinerTest.java Thu Sep 27 22:24:23 2018
@@ -71,16 +71,16 @@ public abstract class AbstractCombinerTe
protected BaseHierarchicalConfiguration createCombinedConfiguration()
throws ConfigurationException
{
- XMLConfiguration conf1 = new XMLConfiguration();
+ final XMLConfiguration conf1 = new XMLConfiguration();
new FileHandler(conf1).load(CONF1);
- XMLConfiguration conf2 = new XMLConfiguration();
+ final XMLConfiguration conf2 = new XMLConfiguration();
new FileHandler(conf2).load(CONF2);
- ImmutableNode cn =
+ final ImmutableNode cn =
combiner.combine(conf1.getNodeModel().getNodeHandler()
.getRootNode(), conf2.getNodeModel().getNodeHandler()
.getRootNode());
- BaseHierarchicalConfiguration result = new BaseHierarchicalConfiguration();
+ final BaseHierarchicalConfiguration result = new BaseHierarchicalConfiguration();
result.getNodeModel().setRootNode(cn);
return result;
Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/tree/AbstractImmutableNodeHandlerTest.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/tree/AbstractImmutableNodeHandlerTest.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/tree/AbstractImmutableNodeHandlerTest.java (original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/tree/AbstractImmutableNodeHandlerTest.java Thu Sep 27 22:24:23 2018
@@ -57,10 +57,10 @@ public abstract class AbstractImmutableN
@Test
public void testGetParentNode()
{
- NodeHandler<ImmutableNode> handler = createHandler(ROOT_AUTHORS_TREE);
+ final NodeHandler<ImmutableNode> handler = createHandler(ROOT_AUTHORS_TREE);
for (int authorIdx = 0; authorIdx < NodeStructureHelper.authorsLength(); authorIdx++)
{
- ImmutableNode authorNode =
+ final ImmutableNode authorNode =
nodeForKey(handler.getRootNode(),
NodeStructureHelper.author(authorIdx));
assertSame(
@@ -69,22 +69,22 @@ public abstract class AbstractImmutableN
for (int workIdx = 0; workIdx < NodeStructureHelper
.worksLength(authorIdx); workIdx++)
{
- String workKey =
+ final String workKey =
NodeStructureHelper.appendPath(
NodeStructureHelper.author(authorIdx),
NodeStructureHelper.work(authorIdx, workIdx));
- ImmutableNode workNode =
+ final ImmutableNode workNode =
nodeForKey(handler.getRootNode(), workKey);
assertSame("Wrong parent for " + workKey, authorNode,
handler.getParent(workNode));
for (int personaIdx = 0; personaIdx < NodeStructureHelper
.personaeLength(authorIdx, workIdx); personaIdx++)
{
- String personKey =
+ final String personKey =
NodeStructureHelper.appendPath(workKey,
NodeStructureHelper.persona(authorIdx,
workIdx, personaIdx));
- ImmutableNode personNode =
+ final ImmutableNode personNode =
nodeForKey(handler.getRootNode(), personKey);
assertSame("Wrong parent for " + personKey, workNode,
handler.getParent(personNode));
@@ -99,7 +99,7 @@ public abstract class AbstractImmutableN
@Test
public void testGetParentForRoot()
{
- NodeHandler<ImmutableNode> handler = createHandler(ROOT_AUTHORS_TREE);
+ final NodeHandler<ImmutableNode> handler = createHandler(ROOT_AUTHORS_TREE);
assertNull("Got a parent", handler.getParent(ROOT_AUTHORS_TREE));
}
@@ -110,7 +110,7 @@ public abstract class AbstractImmutableN
@Test(expected = IllegalArgumentException.class)
public void testGetParentInvalidNode()
{
- NodeHandler<ImmutableNode> handler = createHandler(ROOT_AUTHORS_TREE);
+ final NodeHandler<ImmutableNode> handler = createHandler(ROOT_AUTHORS_TREE);
handler.getParent(new ImmutableNode.Builder().name("unknown").create());
}
@@ -120,8 +120,8 @@ public abstract class AbstractImmutableN
@Test
public void testNodeHandlerName()
{
- NodeHandler<ImmutableNode> handler = createHandler(ROOT_AUTHORS_TREE);
- ImmutableNode author =
+ final NodeHandler<ImmutableNode> handler = createHandler(ROOT_AUTHORS_TREE);
+ final ImmutableNode author =
nodeForKey(handler, NodeStructureHelper.author(0));
assertEquals("Wrong node name", NodeStructureHelper.author(0),
handler.nodeName(author));
@@ -133,9 +133,9 @@ public abstract class AbstractImmutableN
@Test
public void testNodeHandlerValue()
{
- NodeHandler<ImmutableNode> handler = createHandler(ROOT_AUTHORS_TREE);
+ final NodeHandler<ImmutableNode> handler = createHandler(ROOT_AUTHORS_TREE);
ImmutableNode work = nodeForKey(handler, "Shakespeare/The Tempest");
- int year = 1611;
+ final int year = 1611;
work = work.setValue(year);
assertEquals("Wrong value", year, handler.getValue(work));
}
@@ -146,8 +146,8 @@ public abstract class AbstractImmutableN
@Test
public void testNodeHandlerGetChildren()
{
- NodeHandler<ImmutableNode> handler = createHandler(ROOT_AUTHORS_TREE);
- ImmutableNode node =
+ final NodeHandler<ImmutableNode> handler = createHandler(ROOT_AUTHORS_TREE);
+ final ImmutableNode node =
nodeForKey(handler, NodeStructureHelper.author(0));
assertSame("Wrong children", node.getChildren(),
handler.getChildren(node));
@@ -159,13 +159,13 @@ public abstract class AbstractImmutableN
@Test
public void testNodeHandlerGetChildrenByName()
{
- NodeHandler<ImmutableNode> handler = createHandler(ROOT_PERSONAE_TREE);
- String name = "Achilles";
- Set<ImmutableNode> children =
+ final NodeHandler<ImmutableNode> handler = createHandler(ROOT_PERSONAE_TREE);
+ final String name = "Achilles";
+ final Set<ImmutableNode> children =
new HashSet<>(handler.getChildren(
ROOT_PERSONAE_TREE, name));
assertEquals("Wrong number of children", 3, children.size());
- for (ImmutableNode c : children)
+ for (final ImmutableNode c : children)
{
assertEquals("Wrong node name", name, c.getNodeName());
}
@@ -177,8 +177,8 @@ public abstract class AbstractImmutableN
@Test(expected = UnsupportedOperationException.class)
public void testNodeHandlerGetChildrenByNameImmutable()
{
- NodeHandler<ImmutableNode> handler = createHandler(ROOT_PERSONAE_TREE);
- List<ImmutableNode> children =
+ final NodeHandler<ImmutableNode> handler = createHandler(ROOT_PERSONAE_TREE);
+ final List<ImmutableNode> children =
handler.getChildren(ROOT_PERSONAE_TREE, "Ajax");
children.add(null);
}
@@ -189,8 +189,8 @@ public abstract class AbstractImmutableN
@Test
public void testNodeHandlerGetChildAtIndex()
{
- NodeHandler<ImmutableNode> handler = createHandler(ROOT_AUTHORS_TREE);
- ImmutableNode node =
+ final NodeHandler<ImmutableNode> handler = createHandler(ROOT_AUTHORS_TREE);
+ final ImmutableNode node =
nodeForKey(handler, NodeStructureHelper.author(0));
assertSame("Wrong child", node.getChildren().get(1),
handler.getChild(node, 1));
@@ -202,10 +202,10 @@ public abstract class AbstractImmutableN
@Test
public void testNodeHandlerIndexOfChild()
{
- NodeHandler<ImmutableNode> handler = createHandler(ROOT_AUTHORS_TREE);
- String key = "Simmons/Hyperion";
- ImmutableNode parent = nodeForKey(handler, key);
- ImmutableNode child = nodeForKey(handler, key + "/Weintraub");
+ final NodeHandler<ImmutableNode> handler = createHandler(ROOT_AUTHORS_TREE);
+ final String key = "Simmons/Hyperion";
+ final ImmutableNode parent = nodeForKey(handler, key);
+ final ImmutableNode child = nodeForKey(handler, key + "/Weintraub");
assertEquals("Wrong child index", 3,
handler.indexOfChild(parent, child));
}
@@ -216,9 +216,9 @@ public abstract class AbstractImmutableN
@Test
public void testNodeHandlerIndexOfUnknownChild()
{
- NodeHandler<ImmutableNode> handler = createHandler(ROOT_AUTHORS_TREE);
- ImmutableNode parent = nodeForKey(handler, "Homer/Ilias");
- ImmutableNode child =
+ final NodeHandler<ImmutableNode> handler = createHandler(ROOT_AUTHORS_TREE);
+ final ImmutableNode parent = nodeForKey(handler, "Homer/Ilias");
+ final ImmutableNode child =
nodeForKey(handler,
"Shakespeare/Troilus and Cressida/Achilles");
assertEquals("Wrong child index", -1,
@@ -231,8 +231,8 @@ public abstract class AbstractImmutableN
@Test
public void testNodeHandlerGetChildrenCountAll()
{
- NodeHandler<ImmutableNode> handler = createHandler(ROOT_AUTHORS_TREE);
- ImmutableNode node =
+ final NodeHandler<ImmutableNode> handler = createHandler(ROOT_AUTHORS_TREE);
+ final ImmutableNode node =
nodeForKey(handler, NodeStructureHelper.author(0));
assertEquals("Wrong number of children",
NodeStructureHelper.worksLength(0),
@@ -246,7 +246,7 @@ public abstract class AbstractImmutableN
@Test
public void testNodeHandlerGetChildrenCountSpecific()
{
- NodeHandler<ImmutableNode> handler = createHandler(ROOT_PERSONAE_TREE);
+ final NodeHandler<ImmutableNode> handler = createHandler(ROOT_PERSONAE_TREE);
assertEquals("Wrong number of children", 3,
handler.getChildrenCount(ROOT_PERSONAE_TREE, "Achilles"));
}
@@ -257,8 +257,8 @@ public abstract class AbstractImmutableN
@Test
public void testNodeHandlerGetAttributes()
{
- NodeHandler<ImmutableNode> handler = createHandler(ROOT_PERSONAE_TREE);
- ImmutableNode node = nodeForKey(handler, "Puck");
+ final NodeHandler<ImmutableNode> handler = createHandler(ROOT_PERSONAE_TREE);
+ final ImmutableNode node = nodeForKey(handler, "Puck");
assertEquals("Wrong attributes", node.getAttributes().keySet(),
handler.getAttributes(node));
}
@@ -269,8 +269,8 @@ public abstract class AbstractImmutableN
@Test(expected = UnsupportedOperationException.class)
public void testNodeHandlerGetAttributesImmutable()
{
- NodeHandler<ImmutableNode> handler = createHandler(ROOT_PERSONAE_TREE);
- ImmutableNode node = nodeForKey(handler, "Puck");
+ final NodeHandler<ImmutableNode> handler = createHandler(ROOT_PERSONAE_TREE);
+ final ImmutableNode node = nodeForKey(handler, "Puck");
handler.getAttributes(node).add("test");
}
@@ -280,8 +280,8 @@ public abstract class AbstractImmutableN
@Test
public void testNodeHandlerHasAttributesTrue()
{
- NodeHandler<ImmutableNode> handler = createHandler(ROOT_PERSONAE_TREE);
- ImmutableNode node = nodeForKey(handler, "Puck");
+ final NodeHandler<ImmutableNode> handler = createHandler(ROOT_PERSONAE_TREE);
+ final ImmutableNode node = nodeForKey(handler, "Puck");
assertTrue("No attributes", handler.hasAttributes(node));
}
@@ -291,7 +291,7 @@ public abstract class AbstractImmutableN
@Test
public void testNodeHandlerHasAttributesFalse()
{
- NodeHandler<ImmutableNode> handler = createHandler(ROOT_PERSONAE_TREE);
+ final NodeHandler<ImmutableNode> handler = createHandler(ROOT_PERSONAE_TREE);
assertFalse("Got attributes",
handler.hasAttributes(ROOT_PERSONAE_TREE));
}
@@ -302,8 +302,8 @@ public abstract class AbstractImmutableN
@Test
public void testNodeHandlerGetAttributeValue()
{
- NodeHandler<ImmutableNode> handler = createHandler(ROOT_PERSONAE_TREE);
- ImmutableNode node = nodeForKey(handler, "Prospero");
+ final NodeHandler<ImmutableNode> handler = createHandler(ROOT_PERSONAE_TREE);
+ final ImmutableNode node = nodeForKey(handler, "Prospero");
assertEquals("Wrong value", "Shakespeare", handler.getAttributeValue(
node, NodeStructureHelper.ATTR_AUTHOR));
}
@@ -314,8 +314,8 @@ public abstract class AbstractImmutableN
@Test
public void testNodeHandlerIsDefinedChildren()
{
- NodeHandler<ImmutableNode> handler = createHandler(ROOT_AUTHORS_TREE);
- ImmutableNode node =
+ final NodeHandler<ImmutableNode> handler = createHandler(ROOT_AUTHORS_TREE);
+ final ImmutableNode node =
nodeForKey(handler, NodeStructureHelper.author(2));
assertTrue("Not defined", handler.isDefined(node));
}
@@ -326,8 +326,8 @@ public abstract class AbstractImmutableN
@Test
public void testNodeHandlerIsDefinedAttributes()
{
- NodeHandler<ImmutableNode> handler = createHandler(ROOT_PERSONAE_TREE);
- ImmutableNode node =
+ final NodeHandler<ImmutableNode> handler = createHandler(ROOT_PERSONAE_TREE);
+ final ImmutableNode node =
new ImmutableNode.Builder().addAttribute(
NodeStructureHelper.ATTR_AUTHOR,
NodeStructureHelper.author(0)).create();
@@ -340,8 +340,8 @@ public abstract class AbstractImmutableN
@Test
public void testNodeHandlerIsDefinedValue()
{
- NodeHandler<ImmutableNode> handler = createHandler(ROOT_PERSONAE_TREE);
- ImmutableNode node = new ImmutableNode.Builder().value(42).create();
+ final NodeHandler<ImmutableNode> handler = createHandler(ROOT_PERSONAE_TREE);
+ final ImmutableNode node = new ImmutableNode.Builder().value(42).create();
assertTrue("Not defined", handler.isDefined(node));
}
@@ -351,8 +351,8 @@ public abstract class AbstractImmutableN
@Test
public void testNodeHandlerIsDefinedFalse()
{
- NodeHandler<ImmutableNode> handler = createHandler(ROOT_PERSONAE_TREE);
- ImmutableNode node =
+ final NodeHandler<ImmutableNode> handler = createHandler(ROOT_PERSONAE_TREE);
+ final ImmutableNode node =
new ImmutableNode.Builder().name(NodeStructureHelper.author(1))
.create();
assertFalse("Defined", handler.isDefined(node));
@@ -371,18 +371,18 @@ public abstract class AbstractImmutableN
NodeStructureHelper.author(1));
final Set<String> encounteredAuthors = new HashSet<>();
- NodeMatcher<ImmutableNode> matcher = new NodeMatcher<ImmutableNode>()
+ final NodeMatcher<ImmutableNode> matcher = new NodeMatcher<ImmutableNode>()
{
@Override
- public <T> boolean matches(T node, NodeHandler<T> paramHandler,
- ImmutableNode criterion)
+ public <T> boolean matches(final T node, final NodeHandler<T> paramHandler,
+ final ImmutableNode criterion)
{
encounteredAuthors.add(paramHandler.nodeName(node));
return node == target;
}
};
- List<ImmutableNode> result =
+ final List<ImmutableNode> result =
handler.getMatchingChildren(handler.getRootNode(), matcher,
target);
assertEquals("Wrong number of matched nodes", 1, result.size());
@@ -402,8 +402,8 @@ public abstract class AbstractImmutableN
@Test(expected = UnsupportedOperationException.class)
public void testNodeHandlerGetMatchingChildrenImmutable()
{
- NodeHandler<ImmutableNode> handler = createHandler(ROOT_AUTHORS_TREE);
- List<ImmutableNode> result =
+ final NodeHandler<ImmutableNode> handler = createHandler(ROOT_AUTHORS_TREE);
+ final List<ImmutableNode> result =
handler.getMatchingChildren(handler.getRootNode(),
new DummyNodeMatcher(), this);
result.clear();
@@ -415,7 +415,7 @@ public abstract class AbstractImmutableN
@Test
public void testNodeHandlerGetMatchingChildrenCount()
{
- NodeHandler<ImmutableNode> handler = createHandler(ROOT_AUTHORS_TREE);
+ final NodeHandler<ImmutableNode> handler = createHandler(ROOT_AUTHORS_TREE);
assertEquals("Wrong result", NodeStructureHelper.authorsLength(),
handler.getMatchingChildrenCount(handler.getRootNode(),
new DummyNodeMatcher(), this));
@@ -427,7 +427,7 @@ public abstract class AbstractImmutableN
private static class DummyNodeMatcher implements NodeMatcher<Object>
{
@Override
- public <T> boolean matches(T node, NodeHandler<T> handler, Object criterion) {
+ public <T> boolean matches(final T node, final NodeHandler<T> handler, final Object criterion) {
return true;
}
}
Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/tree/NodeStructureHelper.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/tree/NodeStructureHelper.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/tree/NodeStructureHelper.java (original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/tree/NodeStructureHelper.java Thu Sep 27 22:24:23 2018
@@ -135,7 +135,7 @@ public class NodeStructureHelper
* @param idx the index
* @return the name of this author
*/
- public static String author(int idx)
+ public static String author(final int idx)
{
return AUTHORS[idx];
}
@@ -146,7 +146,7 @@ public class NodeStructureHelper
* @param authorIdx the author index
* @return the number of works of this author
*/
- public static int worksLength(int authorIdx)
+ public static int worksLength(final int authorIdx)
{
return WORKS[authorIdx].length;
}
@@ -158,7 +158,7 @@ public class NodeStructureHelper
* @param idx the index of the work
* @return the desired work
*/
- public static String work(int authorIdx, int idx)
+ public static String work(final int authorIdx, final int idx)
{
return WORKS[authorIdx][idx];
}
@@ -170,7 +170,7 @@ public class NodeStructureHelper
* @param workIdx the index of the work
* @return the number of personae in this work
*/
- public static int personaeLength(int authorIdx, int workIdx)
+ public static int personaeLength(final int authorIdx, final int workIdx)
{
return PERSONAE[authorIdx][workIdx].length;
}
@@ -183,7 +183,7 @@ public class NodeStructureHelper
* @param personaIdx the index of the persona
* @return the name of this persona
*/
- public static String persona(int authorIdx, int workIdx, int personaIdx)
+ public static String persona(final int authorIdx, final int workIdx, final int personaIdx)
{
return PERSONAE[authorIdx][workIdx][personaIdx];
}
@@ -204,7 +204,7 @@ public class NodeStructureHelper
* @param idx the index of the table
* @return the name of the test table with this index
*/
- public static String table(int idx)
+ public static String table(final int idx)
{
return TABLES[idx];
}
@@ -215,7 +215,7 @@ public class NodeStructureHelper
* @param tabIdx the index of the table
* @return the number of fields in this table
*/
- public static int fieldsLength(int tabIdx)
+ public static int fieldsLength(final int tabIdx)
{
return FIELDS[tabIdx].length;
}
@@ -227,7 +227,7 @@ public class NodeStructureHelper
* @param fldIdx the index of the field
* @return the name of this field
*/
- public static String field(int tabIdx, int fldIdx)
+ public static String field(final int tabIdx, final int fldIdx)
{
return FIELDS[tabIdx][fldIdx];
}
@@ -240,9 +240,9 @@ public class NodeStructureHelper
* @param component the component to be added
* @return the resulting path
*/
- public static String appendPath(String path, String component)
+ public static String appendPath(final String path, final String component)
{
- StringBuilder buf =
+ final StringBuilder buf =
new StringBuilder(StringUtils.length(path)
+ StringUtils.length(component) + 1);
buf.append(path).append(PATH_SEPARATOR).append(component);
@@ -260,9 +260,9 @@ public class NodeStructureHelper
* @return the node with this key
* @throws NoSuchElementException if the key cannot be resolved
*/
- public static ImmutableNode nodeForKey(ImmutableNode root, String key)
+ public static ImmutableNode nodeForKey(final ImmutableNode root, final String key)
{
- String[] components = key.split(PATH_SEPARATOR);
+ final String[] components = key.split(PATH_SEPARATOR);
return findNode(root, components, 0);
}
@@ -277,7 +277,7 @@ public class NodeStructureHelper
* @return the found target node
* @throws NoSuchElementException if the desired node cannot be found
*/
- public static ImmutableNode nodeForKey(InMemoryNodeModel model, String key)
+ public static ImmutableNode nodeForKey(final InMemoryNodeModel model, final String key)
{
return nodeForKey(model.getRootNode(), key);
}
@@ -293,8 +293,8 @@ public class NodeStructureHelper
* @return the found target node
* @throws NoSuchElementException if the desired node cannot be found
*/
- public static ImmutableNode nodeForKey(NodeHandler<ImmutableNode> handler,
- String key)
+ public static ImmutableNode nodeForKey(final NodeHandler<ImmutableNode> handler,
+ final String key)
{
return nodeForKey(handler.getRootNode(), key);
}
@@ -306,7 +306,7 @@ public class NodeStructureHelper
* @param path an array with the expected node names on the path
* @return the resulting path as string
*/
- public static String nodePath(String... path)
+ public static String nodePath(final String... path)
{
return StringUtils.join(path, PATH_SEPARATOR);
}
@@ -318,7 +318,7 @@ public class NodeStructureHelper
* @param path an array with the expected node names on the path
* @return the resulting path as string
*/
- public static String nodePathWithEndNode(String endNode, String... path)
+ public static String nodePathWithEndNode(final String endNode, final String... path)
{
return nodePath(path) + PATH_SEPARATOR + endNode;
}
@@ -330,7 +330,7 @@ public class NodeStructureHelper
* @param value the node's value
* @return the new node
*/
- public static ImmutableNode createNode(String name, Object value)
+ public static ImmutableNode createNode(final String name, final Object value)
{
return new ImmutableNode.Builder().name(name).value(value).create();
}
@@ -343,9 +343,9 @@ public class NodeStructureHelper
* @param name the name of the field
* @return the field node
*/
- public static ImmutableNode createFieldNode(String name)
+ public static ImmutableNode createFieldNode(final String name)
{
- ImmutableNode.Builder fldBuilder = new ImmutableNode.Builder(1);
+ final ImmutableNode.Builder fldBuilder = new ImmutableNode.Builder(1);
fldBuilder.addChild(createNode("name", name));
return fldBuilder.name("field").create();
}
@@ -358,6 +358,7 @@ public class NodeStructureHelper
public static NodeKeyResolver<ImmutableNode> createResolverMock()
{
@SuppressWarnings("unchecked")
+ final
NodeKeyResolver<ImmutableNode> mock =
EasyMock.createMock(NodeKeyResolver.class);
return mock;
@@ -371,7 +372,7 @@ public class NodeStructureHelper
*/
@SuppressWarnings("unchecked")
public static void expectResolveKeyForQueries(
- NodeKeyResolver<ImmutableNode> resolver)
+ final NodeKeyResolver<ImmutableNode> resolver)
{
EasyMock.expect(
resolver.resolveKey(EasyMock.anyObject(ImmutableNode.class),
@@ -382,10 +383,10 @@ public class NodeStructureHelper
@Override
public List<QueryResult<ImmutableNode>> answer()
throws Throwable {
- ImmutableNode root =
+ final ImmutableNode root =
(ImmutableNode) EasyMock.getCurrentArguments()[0];
- String key = (String) EasyMock.getCurrentArguments()[1];
- NodeHandler<ImmutableNode> handler =
+ final String key = (String) EasyMock.getCurrentArguments()[1];
+ final NodeHandler<ImmutableNode> handler =
(NodeHandler<ImmutableNode>) EasyMock
.getCurrentArguments()[2];
return DefaultExpressionEngine.INSTANCE.query(root,
@@ -401,7 +402,7 @@ public class NodeStructureHelper
* @param resolver the {@code NodeKeyResolver} mock
*/
public static void expectResolveAddKeys(
- NodeKeyResolver<ImmutableNode> resolver)
+ final NodeKeyResolver<ImmutableNode> resolver)
{
EasyMock.expect(
resolver.resolveAddKey(EasyMock.anyObject(ImmutableNode.class),
@@ -410,10 +411,10 @@ public class NodeStructureHelper
.andAnswer(new IAnswer<NodeAddData<ImmutableNode>>() {
@Override
public NodeAddData<ImmutableNode> answer() throws Throwable {
- ImmutableNode root =
+ final ImmutableNode root =
(ImmutableNode) EasyMock.getCurrentArguments()[0];
- String key = (String) EasyMock.getCurrentArguments()[1];
- TreeData handler =
+ final String key = (String) EasyMock.getCurrentArguments()[1];
+ final TreeData handler =
(TreeData) EasyMock.getCurrentArguments()[2];
return DefaultExpressionEngine.INSTANCE.prepareAdd(
root, key, handler);
@@ -430,17 +431,17 @@ public class NodeStructureHelper
* @param fields an array with the fields of the single tables
* @return the resulting nodes structure
*/
- public static ImmutableNode createTablesTree(String[] tables,
- String[][] fields)
+ public static ImmutableNode createTablesTree(final String[] tables,
+ final String[][] fields)
{
- ImmutableNode.Builder bldTables =
+ final ImmutableNode.Builder bldTables =
new ImmutableNode.Builder(tables.length);
bldTables.name("tables");
for (int i = 0; i < tables.length; i++)
{
- ImmutableNode.Builder bldTable = new ImmutableNode.Builder(2);
+ final ImmutableNode.Builder bldTable = new ImmutableNode.Builder(2);
bldTable.addChild(createNode("name", tables[i]));
- ImmutableNode.Builder bldFields =
+ final ImmutableNode.Builder bldFields =
new ImmutableNode.Builder(fields[i].length);
bldFields.name("fields");
@@ -473,7 +474,7 @@ public class NodeStructureHelper
*/
public static String[][] getClonedFields()
{
- String[][] fieldNamesNew = new String[FIELDS.length][];
+ final String[][] fieldNamesNew = new String[FIELDS.length][];
for (int i = 0; i < FIELDS.length; i++)
{
fieldNamesNew[i] = FIELDS[i].clone();
@@ -490,17 +491,17 @@ public class NodeStructureHelper
*/
private static ImmutableNode createAuthorsTree()
{
- ImmutableNode.Builder rootBuilder =
+ final ImmutableNode.Builder rootBuilder =
new ImmutableNode.Builder(AUTHORS.length);
for (int author = 0; author < AUTHORS.length; author++)
{
- ImmutableNode.Builder authorBuilder = new ImmutableNode.Builder();
+ final ImmutableNode.Builder authorBuilder = new ImmutableNode.Builder();
authorBuilder.name(AUTHORS[author]);
for (int work = 0; work < WORKS[author].length; work++)
{
- ImmutableNode.Builder workBuilder = new ImmutableNode.Builder();
+ final ImmutableNode.Builder workBuilder = new ImmutableNode.Builder();
workBuilder.name(WORKS[author][work]);
- for (String person : PERSONAE[author][work])
+ for (final String person : PERSONAE[author][work])
{
workBuilder.addChild(new ImmutableNode.Builder().name(
person).create());
@@ -522,23 +523,23 @@ public class NodeStructureHelper
*/
private static ImmutableNode createPersonaeTree()
{
- ImmutableNode.Builder rootBuilder = new ImmutableNode.Builder();
+ final ImmutableNode.Builder rootBuilder = new ImmutableNode.Builder();
for (int author = 0; author < AUTHORS.length; author++)
{
for (int work = 0; work < WORKS[author].length; work++)
{
- for (String person : PERSONAE[author][work])
+ for (final String person : PERSONAE[author][work])
{
- ImmutableNode orgValue =
+ final ImmutableNode orgValue =
new ImmutableNode.Builder().name(ELEM_ORG_VALUE)
.value("yes")
.addAttribute(ATTR_TESTED, Boolean.FALSE)
.create();
- ImmutableNode workNode =
+ final ImmutableNode workNode =
new ImmutableNode.Builder(1)
.name(WORKS[author][work])
.addChild(orgValue).create();
- ImmutableNode personNode =
+ final ImmutableNode personNode =
new ImmutableNode.Builder(1).name(person)
.addAttribute(ATTR_AUTHOR, AUTHORS[author])
.addChild(workNode).create();
@@ -576,15 +577,15 @@ public class NodeStructureHelper
* @return the found target node
* @throws NoSuchElementException if the desired node cannot be found
*/
- private static ImmutableNode findNode(ImmutableNode parent,
- String[] components, int currentIdx)
+ private static ImmutableNode findNode(final ImmutableNode parent,
+ final String[] components, final int currentIdx)
{
if (currentIdx >= components.length)
{
return parent;
}
- Matcher m = PAT_KEY_WITH_INDEX.matcher(components[currentIdx]);
+ final Matcher m = PAT_KEY_WITH_INDEX.matcher(components[currentIdx]);
String childName;
int childIndex;
if (m.matches())
@@ -599,7 +600,7 @@ public class NodeStructureHelper
}
int foundIdx = 0;
- for (ImmutableNode node : parent.getChildren())
+ for (final ImmutableNode node : parent.getChildren())
{
if (childName.equals(node.getNodeName()))
{
Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/tree/TestDefaultConfigurationKey.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/tree/TestDefaultConfigurationKey.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/tree/TestDefaultConfigurationKey.java (original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/tree/TestDefaultConfigurationKey.java Thu Sep 27 22:24:23 2018
@@ -63,7 +63,7 @@ public class TestDefaultConfigurationKey
* @param k the key for initialization
* @return the newly created {@code DefaultConfigurationKey} instance
*/
- private DefaultConfigurationKey key(String k)
+ private DefaultConfigurationKey key(final String k)
{
return new DefaultConfigurationKey(expressionEngine, k);
}
@@ -109,7 +109,7 @@ public class TestDefaultConfigurationKey
@Test
public void testIsAttributeKeyWithoutEndMarkers()
{
- DefaultExpressionEngineSymbols symbols =
+ final DefaultExpressionEngineSymbols symbols =
symbols()
.setAttributeEnd(null)
.setAttributeStart(
@@ -234,7 +234,7 @@ public class TestDefaultConfigurationKey
@Test
public void testConstructAttributeKeyWithoutEndMarkers()
{
- DefaultExpressionEngineSymbols symbols =
+ final DefaultExpressionEngineSymbols symbols =
symbols()
.setAttributeEnd(null)
.setAttributeStart(
@@ -326,9 +326,9 @@ public class TestDefaultConfigurationKey
@Test
public void testEquals()
{
- DefaultConfigurationKey k1 = key(TESTKEY);
+ final DefaultConfigurationKey k1 = key(TESTKEY);
assertTrue("Key not equal to itself", k1.equals(k1));
- DefaultConfigurationKey k2 = key(TESTKEY);
+ final DefaultConfigurationKey k2 = key(TESTKEY);
assertTrue("Keys are not equal", k1.equals(k2));
assertTrue("Not reflexiv", k2.equals(k1));
assertEquals("Hash codes not equal", k1.hashCode(), k2.hashCode());
@@ -359,7 +359,7 @@ public class TestDefaultConfigurationKey
public void testIterate()
{
key.append(TESTKEY);
- DefaultConfigurationKey.KeyIterator it = key.iterator();
+ final DefaultConfigurationKey.KeyIterator it = key.iterator();
assertTrue("No key parts", it.hasNext());
assertEquals("Wrong key part", "tables", it.nextKey());
assertEquals("Wrong key part", "table", it.nextKey());
@@ -381,7 +381,7 @@ public class TestDefaultConfigurationKey
it.next();
fail("Could iterate over the iteration's end!");
}
- catch (NoSuchElementException nex)
+ catch (final NoSuchElementException nex)
{
// ok
}
@@ -396,7 +396,7 @@ public class TestDefaultConfigurationKey
{
assertFalse(key.iterator().hasNext());
key.append("simple");
- DefaultConfigurationKey.KeyIterator it = key.iterator();
+ final DefaultConfigurationKey.KeyIterator it = key.iterator();
assertTrue(it.hasNext());
assertEquals("simple", it.next());
it.remove();
@@ -438,7 +438,7 @@ public class TestDefaultConfigurationKey
key.append("trailing..dot..");
key.append(".strange");
assertEquals("my..elem.trailing..dot...strange", key.toString());
- DefaultConfigurationKey.KeyIterator kit = key.iterator();
+ final DefaultConfigurationKey.KeyIterator kit = key.iterator();
assertEquals("Wrong first part", "my.elem", kit.nextKey());
assertEquals("Wrong second part", "trailing.dot.", kit.nextKey());
assertEquals("Wrong third part", "strange", kit.nextKey());
@@ -459,7 +459,7 @@ public class TestDefaultConfigurationKey
key.append("trailing\\.dot\\.");
key.append(".strange");
assertEquals("\\.my\\.elem.trailing\\.dot\\..strange", key.toString());
- DefaultConfigurationKey.KeyIterator kit = key.iterator();
+ final DefaultConfigurationKey.KeyIterator kit = key.iterator();
assertEquals("Wrong first part", ".my.elem", kit.nextKey());
assertEquals("Wrong second part", "trailing.dot.", kit.nextKey());
assertEquals("Wrong third part", "strange", kit.nextKey());
@@ -479,7 +479,7 @@ public class TestDefaultConfigurationKey
key.append("..my..elem.trailing..dot...strange");
assertEquals("Wrong key", "my..elem.trailing..dot...strange", key
.toString());
- DefaultConfigurationKey.KeyIterator kit = key.iterator();
+ final DefaultConfigurationKey.KeyIterator kit = key.iterator();
final String[] parts =
{ "my", "elem", "trailing", "dot", "strange"};
for (int i = 0; i < parts.length; i++)
@@ -496,7 +496,7 @@ public class TestDefaultConfigurationKey
public void testIterateWithBrackets()
{
key.append("directory.platform(x86).path");
- DefaultConfigurationKey.KeyIterator kit = key.iterator();
+ final DefaultConfigurationKey.KeyIterator kit = key.iterator();
String part = kit.nextKey();
assertEquals("Wrong part 1", "directory", part);
assertFalse("Has index 1", kit.hasIndex());
@@ -520,7 +520,7 @@ public class TestDefaultConfigurationKey
assertEquals("Wrong attribute key with index", TESTATTR + "(0)", key
.toString());
- DefaultConfigurationKey.KeyIterator it = key.iterator();
+ final DefaultConfigurationKey.KeyIterator it = key.iterator();
assertTrue("No first element", it.hasNext());
it.next();
assertTrue("Index not found", it.hasIndex());
@@ -545,7 +545,7 @@ public class TestDefaultConfigurationKey
.create());
key = new DefaultConfigurationKey(expressionEngine);
key.append("this.isa.key");
- DefaultConfigurationKey.KeyIterator kit = key.iterator();
+ final DefaultConfigurationKey.KeyIterator kit = key.iterator();
assertEquals("Wrong first key part", "this", kit.next());
assertFalse("First part is an attribute", kit.isAttribute());
assertTrue("First part is not a property key", kit.isPropertyKey());
@@ -564,7 +564,7 @@ public class TestDefaultConfigurationKey
@Test
public void testCommonKey()
{
- DefaultConfigurationKey k1 = key(TESTKEY);
+ final DefaultConfigurationKey k1 = key(TESTKEY);
DefaultConfigurationKey k2 = key("tables.table(0).name");
DefaultConfigurationKey kc = k1.commonKey(k2);
assertEquals("Wrong common key (1)", key("tables.table(0)"), kc);
@@ -600,8 +600,8 @@ public class TestDefaultConfigurationKey
@Test
public void testDifferenceKeySame()
{
- DefaultConfigurationKey k1 = key(TESTKEY);
- DefaultConfigurationKey kd = k1.differenceKey(k1);
+ final DefaultConfigurationKey k1 = key(TESTKEY);
+ final DefaultConfigurationKey kd = k1.differenceKey(k1);
assertEquals("Got difference for same keys", 0, kd.length());
}
@@ -611,7 +611,7 @@ public class TestDefaultConfigurationKey
@Test
public void testDifferenceKey()
{
- DefaultConfigurationKey k1 = key(TESTKEY);
+ final DefaultConfigurationKey k1 = key(TESTKEY);
DefaultConfigurationKey k2 = key("tables.table(0).name");
DefaultConfigurationKey kd = k1.differenceKey(k2);
assertEquals("Wrong difference (1)", "name", kd.toString());
Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/tree/TestDefaultExpressionEngine.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/tree/TestDefaultExpressionEngine.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/tree/TestDefaultExpressionEngine.java (original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/tree/TestDefaultExpressionEngine.java Thu Sep 27 22:24:23 2018
@@ -162,7 +162,7 @@ public class TestDefaultExpressionEngine
@Test
public void testQueryAttributeEmulation()
{
- DefaultExpressionEngineSymbols symbols =
+ final DefaultExpressionEngineSymbols symbols =
new DefaultExpressionEngineSymbols.Builder(
DefaultExpressionEngineSymbols.DEFAULT_SYMBOLS)
.setAttributeEnd(null)
@@ -180,10 +180,10 @@ public class TestDefaultExpressionEngine
*
* @param key the key to be used
*/
- private void checkQueryRootNode(String key)
+ private void checkQueryRootNode(final String key)
{
- List<QueryResult<ImmutableNode>> results = checkKey(key, null, 1);
- QueryResult<ImmutableNode> result = results.get(0);
+ final List<QueryResult<ImmutableNode>> results = checkKey(key, null, 1);
+ final QueryResult<ImmutableNode> result = results.get(0);
assertFalse("No node result", result.isAttributeResult());
assertSame("Not the root node", root, result.getNode());
}
@@ -235,7 +235,7 @@ public class TestDefaultExpressionEngine
@Test
public void testNodeKey()
{
- ImmutableNode node = root.getChildren().get(0);
+ final ImmutableNode node = root.getChildren().get(0);
assertEquals("Invalid name for descendant of root", "tables", engine
.nodeKey(node, "", handler));
assertEquals("Parent key not respected", "test.tables", engine.nodeKey(
@@ -293,7 +293,7 @@ public class TestDefaultExpressionEngine
@Test
public void testNodeKeyWithEscapedDelimiters()
{
- ImmutableNode node = root.getChildren().get(1);
+ final ImmutableNode node = root.getChildren().get(1);
assertEquals("Wrong escaped key", "connection..settings",
engine.nodeKey(node, "", handler));
assertEquals(
@@ -334,7 +334,7 @@ public class TestDefaultExpressionEngine
public void testNodeKeyWithAlternativeSyntaxAttributePropertyDelimiter()
{
setUpAlternativeSyntax();
- DefaultExpressionEngineSymbols symbols =
+ final DefaultExpressionEngineSymbols symbols =
new DefaultExpressionEngineSymbols.Builder(engine.getSymbols())
.setAttributeStart(
engine.getSymbols().getPropertyDelimiter())
@@ -360,7 +360,7 @@ public class TestDefaultExpressionEngine
assertEquals("Wrong name of new node", "name", data.getNewNodeName());
assertTrue("Path nodes available", data.getPathNodes().isEmpty());
assertEquals("Wrong parent node", "field", data.getParent().getNodeName());
- ImmutableNode nd = data.getParent().getChildren().get(0);
+ final ImmutableNode nd = data.getParent().getChildren().get(0);
assertEquals("Field has no name node", "name", nd.getNodeName());
assertEquals("Incorrect name", "version", nd.getValue());
}
@@ -378,7 +378,7 @@ public class TestDefaultExpressionEngine
assertTrue("Path nodes available", data.getPathNodes().isEmpty());
assertEquals("Wrong type of parent node", "table", data.getParent()
.getNodeName());
- ImmutableNode node = data.getParent().getChildren().get(0);
+ final ImmutableNode node = data.getParent().getChildren().get(0);
assertEquals("Wrong table", tables[0], node.getValue());
data = engine.prepareAdd(root, "tables.table(1).fields.field(2).alias", handler);
@@ -395,7 +395,7 @@ public class TestDefaultExpressionEngine
@Test
public void testPrepareAddAttribute()
{
- NodeAddData<ImmutableNode> data = engine.prepareAdd(root,
+ final NodeAddData<ImmutableNode> data = engine.prepareAdd(root,
"tables.table(0)[@tableSpace]", handler);
assertEquals("Wrong table node", tables[0], data.getParent()
.getChildren().get(0).getValue());
@@ -411,7 +411,7 @@ public class TestDefaultExpressionEngine
@Test
public void testPrepareAddAttributeRoot()
{
- NodeAddData<ImmutableNode> data = engine.prepareAdd(root, "[@newAttr]", handler);
+ final NodeAddData<ImmutableNode> data = engine.prepareAdd(root, "[@newAttr]", handler);
assertSame("Root node is not parent", root, data.getParent());
assertEquals("Wrong name of new node", "newAttr", data.getNewNodeName());
assertTrue("Attribute not detected", data.isAttribute());
@@ -449,7 +449,7 @@ public class TestDefaultExpressionEngine
@Test
public void testPrepareAddWithSameAttributeDelimiter()
{
- DefaultExpressionEngineSymbols symbols =
+ final DefaultExpressionEngineSymbols symbols =
new DefaultExpressionEngineSymbols.Builder(
DefaultExpressionEngineSymbols.DEFAULT_SYMBOLS)
.setAttributeEnd(null)
@@ -529,7 +529,7 @@ public class TestDefaultExpressionEngine
@Test
public void testCanonicalKeyNoDuplicates()
{
- ImmutableNode node = fetchNode("tables.table(0).name");
+ final ImmutableNode node = fetchNode("tables.table(0).name");
assertEquals("Wrong canonical key", "table.name(0)",
engine.canonicalKey(node, "table", handler));
}
@@ -541,8 +541,8 @@ public class TestDefaultExpressionEngine
@Test
public void testCanonicalKeyWithDuplicates()
{
- ImmutableNode tab1 = fetchNode("tables.table(0)");
- ImmutableNode tab2 = fetchNode("tables.table(1)");
+ final ImmutableNode tab1 = fetchNode("tables.table(0)");
+ final ImmutableNode tab2 = fetchNode("tables.table(1)");
assertEquals("Wrong key 1", "tables.table(0)",
engine.canonicalKey(tab1, "tables", handler));
assertEquals("Wrong key 2", "tables.table(1)",
@@ -556,7 +556,7 @@ public class TestDefaultExpressionEngine
@Test
public void testCanonicalKeyNoParentKey()
{
- ImmutableNode node = fetchNode("tables.table(0).fields.field(1).name");
+ final ImmutableNode node = fetchNode("tables.table(0).fields.field(1).name");
assertEquals("Wrong key", "name(0)",
engine.canonicalKey(node, null, handler));
}
@@ -599,7 +599,7 @@ public class TestDefaultExpressionEngine
public void testPrepareAddWithAlternativeMatcher()
{
setUpAlternativeMatcher();
- NodeAddData<ImmutableNode> data =
+ final NodeAddData<ImmutableNode> data =
engine.prepareAdd(root, "tables_.table._fields__._field.name",
handler);
assertEquals("Wrong name of new node", "name", data.getNewNodeName());
@@ -625,19 +625,19 @@ public class TestDefaultExpressionEngine
*/
private static ImmutableNode setUpNodes()
{
- ImmutableNode.Builder nodeTablesBuilder =
+ final ImmutableNode.Builder nodeTablesBuilder =
new ImmutableNode.Builder(tables.length);
nodeTablesBuilder.name("tables");
for (int i = 0; i < tables.length; i++)
{
- ImmutableNode.Builder nodeTableBuilder =
+ final ImmutableNode.Builder nodeTableBuilder =
new ImmutableNode.Builder(2);
nodeTableBuilder.name("table");
nodeTableBuilder.addChild(new ImmutableNode.Builder().name("name")
.value(tables[i]).create());
nodeTableBuilder.addAttribute("type", tabTypes[i]);
- ImmutableNode.Builder nodeFieldsBuilder =
+ final ImmutableNode.Builder nodeFieldsBuilder =
new ImmutableNode.Builder(fields[i].length);
for (int j = 0; j < fields[i].length; j++)
{
@@ -648,9 +648,9 @@ public class TestDefaultExpressionEngine
nodeTablesBuilder.addChild(nodeTableBuilder.create());
}
- ImmutableNode.Builder rootBuilder = new ImmutableNode.Builder();
+ final ImmutableNode.Builder rootBuilder = new ImmutableNode.Builder();
rootBuilder.addChild(nodeTablesBuilder.create());
- ImmutableNode.Builder nodeConnBuilder = new ImmutableNode.Builder();
+ final ImmutableNode.Builder nodeConnBuilder = new ImmutableNode.Builder();
nodeConnBuilder.name("connection.settings");
nodeConnBuilder.addChild(createNode("usr.name", "scott"));
nodeConnBuilder.addChild(createNode("usr.pwd", "tiger"));
@@ -665,7 +665,7 @@ public class TestDefaultExpressionEngine
*/
private void setUpAlternativeSyntax()
{
- DefaultExpressionEngineSymbols symbols =
+ final DefaultExpressionEngineSymbols symbols =
new DefaultExpressionEngineSymbols.Builder()
.setAttributeEnd(null).setAttributeStart("@")
.setPropertyDelimiter("/").setEscapedDelimiter(null)
@@ -679,11 +679,11 @@ public class TestDefaultExpressionEngine
*/
private void setUpAlternativeMatcher()
{
- NodeMatcher<String> matcher = new NodeMatcher<String>()
+ final NodeMatcher<String> matcher = new NodeMatcher<String>()
{
@Override
- public <T> boolean matches(T node, NodeHandler<T> handler,
- String criterion)
+ public <T> boolean matches(final T node, final NodeHandler<T> handler,
+ final String criterion)
{
return handler.nodeName(node).equals(StringUtils.remove(criterion, '_'));
}
@@ -700,11 +700,11 @@ public class TestDefaultExpressionEngine
* @param count the number of expected result nodes
* @return the list with the results of the query
*/
- private List<QueryResult<ImmutableNode>> checkKey(String key, String name,
- int count)
+ private List<QueryResult<ImmutableNode>> checkKey(final String key, final String name,
+ final int count)
{
- List<QueryResult<ImmutableNode>> nodes = query(key, count);
- for (QueryResult<ImmutableNode> result : nodes)
+ final List<QueryResult<ImmutableNode>> nodes = query(key, count);
+ for (final QueryResult<ImmutableNode> result : nodes)
{
if (result.isAttributeResult())
{
@@ -727,9 +727,9 @@ public class TestDefaultExpressionEngine
* @param expCount the expected number of result nodes
* @return the collection of retrieved nodes
*/
- private List<QueryResult<ImmutableNode>> query(String key, int expCount)
+ private List<QueryResult<ImmutableNode>> query(final String key, final int expCount)
{
- List<QueryResult<ImmutableNode>> nodes = engine.query(root, key, handler);
+ final List<QueryResult<ImmutableNode>> nodes = engine.query(root, key, handler);
assertEquals("Wrong number of result nodes for key " + key, expCount,
nodes.size());
return nodes;
@@ -741,9 +741,9 @@ public class TestDefaultExpressionEngine
* @param key the key
* @return the node with this key
*/
- private ImmutableNode fetchNode(String key)
+ private ImmutableNode fetchNode(final String key)
{
- QueryResult<ImmutableNode> result = query(key, 1).get(0);
+ final QueryResult<ImmutableNode> result = query(key, 1).get(0);
assertFalse("An attribute result", result.isAttributeResult());
return result.getNode();
}
@@ -757,10 +757,10 @@ public class TestDefaultExpressionEngine
* @param name the expected name of the result node
* @param value the expected value of the result node
*/
- private void checkKeyValue(String key, String name, String value)
+ private void checkKeyValue(final String key, final String name, final String value)
{
- List<QueryResult<ImmutableNode>> results = checkKey(key, name, 1);
- QueryResult<ImmutableNode> result = results.get(0);
+ final List<QueryResult<ImmutableNode>> results = checkKey(key, name, 1);
+ final QueryResult<ImmutableNode> result = results.get(0);
assertFalse("No node result", result.isAttributeResult());
assertEquals("Wrong value for key " + key, value,
result.getNode().getValue());
@@ -774,10 +774,10 @@ public class TestDefaultExpressionEngine
* @param attr the attribute name
* @param expValue the expected attribute value
*/
- private void checkAttributeValue(String key, String attr, Object expValue)
+ private void checkAttributeValue(final String key, final String attr, final Object expValue)
{
- List<QueryResult<ImmutableNode>> results = checkKey(key, attr, 1);
- QueryResult<ImmutableNode> result = results.get(0);
+ final List<QueryResult<ImmutableNode>> results = checkKey(key, attr, 1);
+ final QueryResult<ImmutableNode> result = results.get(0);
assertTrue("Not an attribute result", result.isAttributeResult());
assertEquals("Wrong attribute value for key " + key, expValue,
result.getAttributeValue(handler));
@@ -789,12 +789,12 @@ public class TestDefaultExpressionEngine
* @param data the add data object
* @param expected the expected path nodes
*/
- private void checkNodePath(NodeAddData<ImmutableNode> data,
- String... expected)
+ private void checkNodePath(final NodeAddData<ImmutableNode> data,
+ final String... expected)
{
assertEquals("Wrong number of path nodes", expected.length, data
.getPathNodes().size());
- Iterator<String> it = data.getPathNodes().iterator();
+ final Iterator<String> it = data.getPathNodes().iterator();
for (int i = 0; i < expected.length; i++)
{
assertEquals("Wrong path node " + i, expected[i], it.next());
@@ -808,9 +808,9 @@ public class TestDefaultExpressionEngine
* @param name the name of the field
* @return the field node
*/
- private static ImmutableNode createFieldNode(String name)
+ private static ImmutableNode createFieldNode(final String name)
{
- ImmutableNode.Builder nodeFieldBuilder = new ImmutableNode.Builder(1);
+ final ImmutableNode.Builder nodeFieldBuilder = new ImmutableNode.Builder(1);
nodeFieldBuilder.addChild(createNode("name", name));
return nodeFieldBuilder.name("field").create();
}
@@ -822,7 +822,7 @@ public class TestDefaultExpressionEngine
* @param value the node value
* @return the node instance
*/
- private static ImmutableNode createNode(String name, Object value)
+ private static ImmutableNode createNode(final String name, final Object value)
{
return new ImmutableNode.Builder().name(name).value(value).create();
}
Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/tree/TestDefaultExpressionEngineSymbols.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/tree/TestDefaultExpressionEngineSymbols.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/tree/TestDefaultExpressionEngineSymbols.java (original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/tree/TestDefaultExpressionEngineSymbols.java Thu Sep 27 22:24:23 2018
@@ -61,7 +61,7 @@ public class TestDefaultExpressionEngine
* @param o1 object 1
* @param o2 object 2
*/
- private static void expEqual(Object o1, Object o2)
+ private static void expEqual(final Object o1, final Object o2)
{
assertTrue("Not equal", o1.equals(o2));
assertTrue("Not symmetric", o2.equals(o1));
@@ -74,7 +74,7 @@ public class TestDefaultExpressionEngine
* @param o1 object 1
* @param o2 object 2
*/
- private static void expNE(Object o1, Object o2)
+ private static void expNE(final Object o1, final Object o2)
{
assertFalse("Equal", o1.equals(o2));
if (o2 != null)
@@ -91,7 +91,7 @@ public class TestDefaultExpressionEngine
{
expEqual(DefaultExpressionEngineSymbols.DEFAULT_SYMBOLS,
DefaultExpressionEngineSymbols.DEFAULT_SYMBOLS);
- DefaultExpressionEngineSymbols s2 =
+ final DefaultExpressionEngineSymbols s2 =
new DefaultExpressionEngineSymbols.Builder(
DefaultExpressionEngineSymbols.DEFAULT_SYMBOLS)
.create();
@@ -116,7 +116,7 @@ public class TestDefaultExpressionEngine
@Test
public void testEqualsFalse()
{
- DefaultExpressionEngineSymbols s1 =
+ final DefaultExpressionEngineSymbols s1 =
DefaultExpressionEngineSymbols.DEFAULT_SYMBOLS;
DefaultExpressionEngineSymbols s2 =
builder().setPropertyDelimiter("/").create();
@@ -157,8 +157,8 @@ public class TestDefaultExpressionEngine
@Test
public void testToString()
{
- DefaultExpressionEngineSymbols symbols = builder().create();
- String s = symbols.toString();
+ final DefaultExpressionEngineSymbols symbols = builder().create();
+ final String s = symbols.toString();
assertThat(
s,
containsString("propertyDelimiter="