Javadoc and Reformat files

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@131116 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stephen Colebourne 2003-08-24 11:29:52 +00:00
parent 9c45ea86bb
commit bd5708f488
2 changed files with 509 additions and 840 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
/* /*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestExtendedProperties.java,v 1.5 2003/08/24 10:50:58 scolebourne Exp $ * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestExtendedProperties.java,v 1.6 2003/08/24 11:29:52 scolebourne Exp $
* $Revision: 1.5 $ * $Revision: 1.6 $
* $Date: 2003/08/24 10:50:58 $ * $Date: 2003/08/24 11:29:52 $
* *
* ==================================================================== * ====================================================================
* *
@ -73,34 +73,29 @@ import java.io.*;
* *
* @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a> * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
* @author Mohan Kishore * @author Mohan Kishore
* @version $Id: TestExtendedProperties.java,v 1.5 2003/08/24 10:50:58 scolebourne Exp $ * @author Stephen Colebourne
* @version $Id: TestExtendedProperties.java,v 1.6 2003/08/24 11:29:52 scolebourne Exp $
*/ */
public class TestExtendedProperties extends TestCase public class TestExtendedProperties extends TestCase {
{
protected ExtendedProperties eprop = new ExtendedProperties(); protected ExtendedProperties eprop = new ExtendedProperties();
public TestExtendedProperties(String testName) public TestExtendedProperties(String testName) {
{
super(testName); super(testName);
} }
public static Test suite() public static Test suite() {
{ return new TestSuite(TestExtendedProperties.class);
return new TestSuite( TestExtendedProperties.class );
} }
public static void main(String args[]) public static void main(String args[]) {
{ String[] testCaseName = { TestExtendedProperties.class.getName()};
String[] testCaseName = { TestExtendedProperties.class.getName() };
junit.textui.TestRunner.main(testCaseName); junit.textui.TestRunner.main(testCaseName);
} }
public void testRetrieve() public void testRetrieve() {
{
/* /*
* should be emptry and return null * should be emptry and return null
*/ */
assertEquals("This returns null", eprop.getProperty("foo"), null); assertEquals("This returns null", eprop.getProperty("foo"), null);
/* /*
@ -114,26 +109,26 @@ public class TestExtendedProperties extends TestCase
* now add another and get a Vector * now add another and get a Vector
*/ */
eprop.addProperty("number", "2"); eprop.addProperty("number", "2");
assertTrue("This returns array", ( eprop.getVector("number") instanceof java.util.Vector ) ); assertTrue("This returns array", (eprop.getVector("number") instanceof java.util.Vector));
/* /*
* now test dan's new fix where we get the first scalar * now test dan's new fix where we get the first scalar
* when we access a vector valued * when we access a vector valued
* property * property
*/ */
assertTrue("This returns scalar", ( eprop.getString("number") instanceof String ) ); assertTrue("This returns scalar", (eprop.getString("number") instanceof String));
/* /*
* test comma separated string properties * test comma separated string properties
*/ */
String prop = "hey, that's a test"; String prop = "hey, that's a test";
eprop.setProperty("prop.string", prop); eprop.setProperty("prop.string", prop);
assertTrue("This returns vector", ( eprop.getVector("prop.string") instanceof java.util.Vector ) ); assertTrue("This returns vector", (eprop.getVector("prop.string") instanceof java.util.Vector));
String prop2 = "hey\\, that's a test"; String prop2 = "hey\\, that's a test";
eprop.remove("prop.string"); eprop.remove("prop.string");
eprop.setProperty("prop.string", prop2); eprop.setProperty("prop.string", prop2);
assertTrue("This returns array", ( eprop.getString("prop.string") instanceof java.lang.String) ); assertTrue("This returns array", (eprop.getString("prop.string") instanceof java.lang.String));
/* /*
* test subset : we want to make sure that the EP doesn't reprocess the data * test subset : we want to make sure that the EP doesn't reprocess the data
@ -142,14 +137,13 @@ public class TestExtendedProperties extends TestCase
ExtendedProperties subEprop = eprop.subset("prop"); ExtendedProperties subEprop = eprop.subset("prop");
assertTrue("Returns the full string", subEprop.getString("string").equals( prop ) ); assertTrue("Returns the full string", subEprop.getString("string").equals(prop));
assertTrue("This returns string for subset", ( subEprop.getString("string") instanceof java.lang.String) ); assertTrue("This returns string for subset", (subEprop.getString("string") instanceof java.lang.String));
assertTrue("This returns array for subset", ( subEprop.getVector("string") instanceof java.util.Vector) ); assertTrue("This returns array for subset", (subEprop.getVector("string") instanceof java.util.Vector));
} }
public void testInterpolation() public void testInterpolation() {
{
eprop.setProperty("applicationRoot", "/home/applicationRoot"); eprop.setProperty("applicationRoot", "/home/applicationRoot");
eprop.setProperty("db", "${applicationRoot}/db/hypersonic"); eprop.setProperty("db", "${applicationRoot}/db/hypersonic");
String dbProp = "/home/applicationRoot/db/hypersonic"; String dbProp = "/home/applicationRoot/db/hypersonic";
@ -219,4 +213,5 @@ public class TestExtendedProperties extends TestCase
fail("There was an exception loading the EP"); fail("There was an exception loading the EP");
} }
} }
} }