You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2006/01/12 02:10:11 UTC
svn commit: r368196 [22/25] - in /jakarta/tapestry: branches/4.0/
branches/4.0/.settings/
branches/4.0/contrib/src/java/org/apache/tapestry/contrib/inspector/
branches/4.0/contrib/src/java/org/apache/tapestry/contrib/jdbc/
branches/4.0/contrib/src/java...
Modified: jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/junit/parse/TestSpecificationParser.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/junit/parse/TestSpecificationParser.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/junit/parse/TestSpecificationParser.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/junit/parse/TestSpecificationParser.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -41,8 +41,9 @@
import org.apache.tapestry.util.xml.DocumentParseException;
/**
- * Tests the specification parser (which reads page and component specifications). Came into being
- * somewhat late, so it just tests new features for the meantime.
+ * Tests the specification parser (which reads page and component
+ * specifications). Came into being somewhat late, so it just tests new features
+ * for the meantime.
*
* @author Howard Lewis Ship
* @since 2.0.4
@@ -60,7 +61,8 @@
* Test 3.0 <message-binding> element.
*/
- public void tesMessageBinding() throws Exception
+ public void tesMessageBinding()
+ throws Exception
{
IComponentSpecification spec = parseComponent("TestMessageBinding.jwc");
@@ -76,7 +78,8 @@
* Tests the 4.0 style <binding> element.
*/
- public void testBinding40() throws Exception
+ public void testBinding40()
+ throws Exception
{
IComponentSpecification spec = parseComponent("Binding40.jwc");
IContainedComponent cc = spec.getComponent("component");
@@ -98,7 +101,8 @@
* @since 2.2
*/
- public void testValidParameterName() throws Exception
+ public void testValidParameterName()
+ throws Exception
{
IComponentSpecification spec = parseComponent("ValidParameterName.jwc");
@@ -114,7 +118,8 @@
* @since 2.2
*/
- public void testInvalidParameterName() throws Exception
+ public void testInvalidParameterName()
+ throws Exception
{
try
{
@@ -135,7 +140,8 @@
* @since 2.2
*/
- public void testInvalidComponentId() throws Exception
+ public void testInvalidComponentId()
+ throws Exception
{
try
{
@@ -156,7 +162,8 @@
* @since 2.2
*/
- public void testInvalidLibraryId() throws Exception
+ public void testInvalidLibraryId()
+ throws Exception
{
try
{
@@ -177,20 +184,18 @@
* @since 2.2
*/
- public void testValidLibrary() throws Exception
+ public void testValidLibrary()
+ throws Exception
{
ILibrarySpecification spec = parseLib("ValidLibrary.library");
checkLine(spec, 24);
- checkList("pageNames", new String[]
- { "FirstPage", "SecondPage" }, spec.getPageNames());
+ checkList("pageNames", new String[] { "FirstPage", "SecondPage" }, spec.getPageNames());
- checkList("componentAliases", new String[]
- { "FirstComponent", "SecondComponent" }, spec.getComponentTypes());
+ checkList("componentAliases", new String[] { "FirstComponent", "SecondComponent" }, spec.getComponentTypes());
- checkList("libraryIds", new String[]
- { "lib1", "lib2" }, spec.getLibraryIds());
+ checkList("libraryIds", new String[] { "lib1", "lib2" }, spec.getLibraryIds());
assertNotNull(spec.getSpecificationLocation());
}
@@ -201,7 +206,8 @@
* @since 2.2
*/
- public void testInvalidAssetName() throws Exception
+ public void testInvalidAssetName()
+ throws Exception
{
try
{
@@ -222,7 +228,8 @@
* @since 2.2
*/
- public void testInvalidPageName() throws Exception
+ public void testInvalidPageName()
+ throws Exception
{
try
{
@@ -243,7 +250,8 @@
* @since 2.2
*/
- public void testInvalidComponentAlias() throws Exception
+ public void testInvalidComponentAlias()
+ throws Exception
{
try
{
@@ -264,7 +272,8 @@
* @since 2.2
*/
- public void testInvalidExtensionName() throws Exception
+ public void testInvalidExtensionName()
+ throws Exception
{
try
{
@@ -280,12 +289,13 @@
}
/**
- * Test case where the document does not have a DOCTYPE
+ * Test case where the document does not have a DOCTYPE.
*
* @since 2.2
*/
- public void testMissingDoctype() throws Exception
+ public void testMissingDoctype()
+ throws Exception
{
try
{
@@ -305,7 +315,8 @@
* Test case where the public id of the document is not known.
*/
- public void testInvalidPublicId() throws Exception
+ public void testInvalidPublicId()
+ throws Exception
{
try
{
@@ -320,12 +331,14 @@
}
/**
- * Test an an application specification can omit the name and engine-class attributes.
+ * Test an an application specification can omit the name and engine-class
+ * attributes.
*
* @since 3.0
*/
- public void testNulledApplication() throws Exception
+ public void testNulledApplication()
+ throws Exception
{
IApplicationSpecification spec = parseApp("NulledApplication.application");
@@ -342,7 +355,8 @@
* @since 3.0
*/
- public void testComponentType() throws Exception
+ public void testComponentType()
+ throws Exception
{
IApplicationSpecification spec = parseApp("ComponentType.application");
@@ -350,10 +364,12 @@
}
/**
- * Test omitting the class name from a component specification (new, in DTD 1.4).
+ * Test omitting the class name from a component specification (new, in DTD
+ * 1.4).
*/
- public void testNulledComponent() throws Exception
+ public void testNulledComponent()
+ throws Exception
{
IComponentSpecification spec = parseComponent("NulledComponent.jwc");
@@ -367,10 +383,12 @@
}
/**
- * Test omitting the class name from a component specification (new, in DTD 1.4).
+ * Test omitting the class name from a component specification (new, in DTD
+ * 1.4).
*/
- public void testNulledPage() throws Exception
+ public void testNulledPage()
+ throws Exception
{
IComponentSpecification spec = parsePage("NulledPage.page");
@@ -382,12 +400,14 @@
}
/**
- * Test the value attribute for the property element (which is new in DTD 1.4).
+ * Test the value attribute for the property element (which is new in DTD
+ * 1.4).
*
* @since 3.0
*/
- public void testPropertyValue() throws Exception
+ public void testPropertyValue()
+ throws Exception
{
IComponentSpecification spec = parsePage("PropertyValue.page");
@@ -403,7 +423,8 @@
* @since 3.0
*/
- public void testStaticBindingValue() throws Exception
+ public void testStaticBindingValue()
+ throws Exception
{
IComponentSpecification spec = parsePage("StaticBindingValue.page");
@@ -428,7 +449,8 @@
assertEquals("literal:hudson", b.getValue());
}
- public void testAttributeAndBody() throws Exception
+ public void testAttributeAndBody()
+ throws Exception
{
try
{
@@ -450,14 +472,15 @@
* @since 3.0
*/
- public void testConfigureValue() throws Exception
+ public void testConfigureValue()
+ throws Exception
{
ILibrarySpecification spec = parseLib("ConfigureValue.library");
checkLine(spec, 22);
checkLine(spec.getExtensionSpecification("bedrock"), 24);
- Bedrock bedrock = (Bedrock) spec.getExtension("bedrock", Bedrock.class);
+ Bedrock bedrock = (Bedrock)spec.getExtension("bedrock", Bedrock.class);
assertEquals("flintstone", bedrock.getFred());
}
@@ -468,9 +491,10 @@
* @since 3.0
*/
- public void testListenerBinding() throws Exception
+ public void testListenerBinding()
+ throws Exception
{
- Log log = (Log) newMock(Log.class);
+ Log log = (Log)newMock(Log.class);
SpecificationParser parser = new SpecificationParser(new DefaultErrorHandler(), log,
new DefaultClassResolver(), new SpecFactory());
@@ -500,12 +524,13 @@
/** @since 3.0 * */
- public void testPropertySpecifications() throws Exception
+ public void testPropertySpecifications()
+ throws Exception
{
IComponentSpecification spec = parsePage("PropertySpecifications.page");
- checkList("propertySpecificationNames", new String[]
- { "bool", "init", "longInitialValue", "persist" }, spec.getPropertySpecificationNames());
+ checkList("propertySpecificationNames", new String[] { "bool", "init", "longInitialValue", "persist" }, spec
+ .getPropertySpecificationNames());
IPropertySpecification ps = spec.getPropertySpecification("bool");
assertEquals("name", "bool", ps.getName());
@@ -542,7 +567,8 @@
/** @since 3.0 * */
- public void testMissingRequiredExtendedAttribute() throws Exception
+ public void testMissingRequiredExtendedAttribute()
+ throws Exception
{
try
{
@@ -552,21 +578,21 @@
}
catch (DocumentParseException ex)
{
- checkException(
- ex,
+ checkException(ex,
"Element <binding> does not specify a value for attribute 'expression', or contain a body value.");
}
}
/** @since 3.0 * */
- public void testMessageBeanInitializer() throws Exception
+ public void testMessageBeanInitializer()
+ throws Exception
{
IComponentSpecification spec = parsePage("MessageBeanInitializer.page");
IBeanSpecification bs = spec.getBeanSpecification("fred");
checkLine(bs, 24);
- BindingBeanInitializer i = (BindingBeanInitializer) bs.getInitializers().get(0);
+ BindingBeanInitializer i = (BindingBeanInitializer)bs.getInitializers().get(0);
assertEquals("barney", i.getPropertyName());
assertEquals("message:rubble", i.getBindingReference());
@@ -574,23 +600,24 @@
}
/**
- * Tests the DTD 3.0 <set-property>element
+ * Tests the DTD 3.0 <set-property> element.
*
* @since 4.0
*/
- public void testExpressionBeanInitializer() throws Exception
+ public void testExpressionBeanInitializer()
+ throws Exception
{
IComponentSpecification spec = parsePage("ExpressionBeanInitializer_3_0.page");
IBeanSpecification bs = spec.getBeanSpecification("zebean");
- BindingBeanInitializer i = (BindingBeanInitializer) bs.getInitializers().get(0);
+ BindingBeanInitializer i = (BindingBeanInitializer)bs.getInitializers().get(0);
assertEquals("barney", i.getPropertyName());
assertEquals("ognl:rubble", i.getBindingReference());
- i = (BindingBeanInitializer) bs.getInitializers().get(1);
+ i = (BindingBeanInitializer)bs.getInitializers().get(1);
assertEquals("fred", i.getPropertyName());
assertEquals("ognl:flintstone", i.getBindingReference());
@@ -598,19 +625,21 @@
/** @since 4.0 */
- public void testBeanSet() throws Exception
+ public void testBeanSet()
+ throws Exception
{
IComponentSpecification spec = parsePage("BeanSet.page");
IBeanSpecification bs = spec.getBeanSpecification("target");
- BindingBeanInitializer i = (BindingBeanInitializer) bs.getInitializers().get(0);
+ BindingBeanInitializer i = (BindingBeanInitializer)bs.getInitializers().get(0);
assertEquals("literal", i.getPropertyName());
assertEquals("literal-string", i.getBindingReference());
}
- public void testInheritInformalParameters() throws Exception
+ public void testInheritInformalParameters()
+ throws Exception
{
IComponentSpecification spec = parseComponent("TestInheritInformal.jwc");
@@ -623,12 +652,14 @@
/** @since 4.0 */
- public void testConfigureExtension() throws Exception
+ public void testConfigureExtension()
+ throws Exception
{
IApplicationSpecification spec = parseApp("ConfigureExtension.application");
IExtensionSpecification es = spec.getExtensionSpecification("my-extension");
- // Note: this is in transition; under 3.0 and earlier, the spec parser was
+ // Note: this is in transition; under 3.0 and earlier, the spec parser
+ // was
// responsible for converting values into object types ... that is now
// done futher down stream.
@@ -638,7 +669,8 @@
assertEquals("An extended string.", es.getConfiguration().get("string"));
}
- public void testConfigureExtensionProperty() throws Exception
+ public void testConfigureExtensionProperty()
+ throws Exception
{
IApplicationSpecification spec = parseApp("ConfigureExtension.application");
IExtensionSpecification es = spec.getExtensionSpecification("my-extension");
@@ -648,7 +680,8 @@
/** @since 4.0 */
- public void testComponentProperty() throws Exception
+ public void testComponentProperty()
+ throws Exception
{
IComponentSpecification cs = parseComponent("ComponentProperty.jwc");
@@ -659,7 +692,8 @@
/** @since 4.0 */
- public void testComponentInjectProperty() throws Exception
+ public void testComponentInjectProperty()
+ throws Exception
{
IComponentSpecification cs = parseComponent("ComponentInjectProperty.jwc");
@@ -674,7 +708,8 @@
/** @since 4.0 */
- public void testBeanDescription() throws Exception
+ public void testBeanDescription()
+ throws Exception
{
IComponentSpecification cs = parseComponent("BeanDescription.jwc");
IBeanSpecification bs = cs.getBeanSpecification("mybean");
@@ -685,7 +720,8 @@
/** @since 4.0 */
- public void testBeanProperty() throws Exception
+ public void testBeanProperty()
+ throws Exception
{
IComponentSpecification cs = parseComponent("BeanDescription.jwc");
IBeanSpecification bs = cs.getBeanSpecification("mybean");
@@ -697,7 +733,8 @@
* @since 4.0
*/
- public void testBeanInject() throws Exception
+ public void testBeanInject()
+ throws Exception
{
IComponentSpecification cs = parseComponent("BeanInject.jwc");
IBeanSpecification bs = cs.getBeanSpecification("bean");
@@ -708,20 +745,22 @@
* @since 4.0
*/
- public void testBeanInitializer() throws Exception
+ public void testBeanInitializer()
+ throws Exception
{
IComponentSpecification cs = parseComponent("BeanInitializer.jwc");
IBeanSpecification bs = cs.getBeanSpecification("bean");
List l = bs.getInitializers();
- LightweightBeanInitializer lbi = (LightweightBeanInitializer) l.get(0);
+ LightweightBeanInitializer lbi = (LightweightBeanInitializer)l.get(0);
assertEquals("foo=bar", lbi.getPropertyName());
}
/** @since 4.0 */
- public void testLibraryDescription() throws Exception
+ public void testLibraryDescription()
+ throws Exception
{
ILibrarySpecification ls = parseLib("LibraryDescription.library");
@@ -730,7 +769,8 @@
/** @since 4.0 */
- public void testPageDescription() throws Exception
+ public void testPageDescription()
+ throws Exception
{
IComponentSpecification spec = parsePage("PageDescription.page");
@@ -743,7 +783,8 @@
* @since 4.0
*/
- public void testRootElementMismatch() throws Exception
+ public void testRootElementMismatch()
+ throws Exception
{
try
{
@@ -752,20 +793,20 @@
}
catch (Exception ex)
{
- checkException(
- ex,
+ checkException(ex,
"Incorrect document type; expected page-specification but received component-specification.");
}
}
/**
- * Checks to make sure that a application or library may not defined a lbirary with id
- * 'framework'.
+ * Checks to make sure that a application or library may not defined a
+ * lbirary with id 'framework'.
*
* @since 4.0
*/
- public void testLibraryFrameworkNamespace() throws Exception
+ public void testLibraryFrameworkNamespace()
+ throws Exception
{
try
{
@@ -779,12 +820,14 @@
}
/**
- * Tests that a <component> element may not have both type and copy-of attributes.
+ * Tests that a <component> element may not have both type and copy-of
+ * attributes.
*
* @since 4.0
*/
- public void testComponentWithTypeAndCopyOf() throws Exception
+ public void testComponentWithTypeAndCopyOf()
+ throws Exception
{
try
{
@@ -803,7 +846,8 @@
* @since 4.0
*/
- public void testComponentWithoutType() throws Exception
+ public void testComponentWithoutType()
+ throws Exception
{
try
{
@@ -812,9 +856,7 @@
}
catch (Exception ex)
{
- checkException(
- ex,
- "Contained component bad does not specify attribute type or copy-of.");
+ checkException(ex, "Contained component bad does not specify attribute type or copy-of.");
}
}
@@ -824,7 +866,8 @@
* @since 4.0
*/
- public void testComponentCopyOf() throws Exception
+ public void testComponentCopyOf()
+ throws Exception
{
IComponentSpecification cs = parseComponent("ComponentCopyOf.jwc");
@@ -879,7 +922,8 @@
* @since 4.0
*/
- public void testServiceElement() throws Exception
+ public void testServiceElement()
+ throws Exception
{
interceptLogging("org.apache.tapestry");
@@ -889,7 +933,8 @@
}
/** @since 4.0 */
- public void testMeta() throws Exception
+ public void testMeta()
+ throws Exception
{
ILibrarySpecification spec = parseLib("Meta.library");
@@ -898,7 +943,8 @@
}
/** @since 4.0 */
- public void testInject() throws Exception
+ public void testInject()
+ throws Exception
{
IComponentSpecification spec = parseComponent("Inject.jwc");
@@ -906,14 +952,14 @@
assertEquals(2, l.size());
- InjectSpecification i1 = (InjectSpecification) l.get(0);
+ InjectSpecification i1 = (InjectSpecification)l.get(0);
assertEquals("fred", i1.getProperty());
assertEquals("object", i1.getType());
assertEquals("flintstone", i1.getObject());
assertNotNull(i1.getLocation());
- InjectSpecification i2 = (InjectSpecification) l.get(1);
+ InjectSpecification i2 = (InjectSpecification)l.get(1);
assertEquals("barney", i2.getProperty());
assertEquals("state", i2.getType());
assertEquals("rubble", i2.getObject());
@@ -921,18 +967,19 @@
}
/**
- * Test that the new <property> element (was <property-specification> in release
- * 3.0) works correctly.
+ * Test that the new <property> element (was
+ * <property-specification> in release 3.0) works correctly.
*
* @since 4.0
*/
- public void testProperty() throws Exception
+ public void testProperty()
+ throws Exception
{
IComponentSpecification spec = parsePage("Property.page");
- checkList("propertySpecificationNames", new String[]
- { "bool", "init", "longInit", "persist" }, spec.getPropertySpecificationNames());
+ checkList("propertySpecificationNames", new String[] { "bool", "init", "longInit", "persist" }, spec
+ .getPropertySpecificationNames());
IPropertySpecification ps = spec.getPropertySpecification("bool");
assertEquals("name", "bool", ps.getName());
@@ -969,12 +1016,13 @@
}
/**
- * Tests parameters specification from a 3.0 DTD
+ * Tests parameters specification from a 3.0 DTD.
*
* @since 4.0
*/
- public void testParameter_3_0() throws Exception
+ public void testParameter_3_0()
+ throws Exception
{
IComponentSpecification spec = parseComponent("Parameter_3_0.jwc");
@@ -1011,13 +1059,14 @@
}
/**
- * Tests the new way default-value is interpreted (as a binding-like value, prefixed to indicate
- * type).
+ * Tests the new way default-value is interpreted (as a binding-like value,
+ * prefixed to indicate type).
*
* @since 4.0
*/
- public void testParameter() throws Exception
+ public void testParameter()
+ throws Exception
{
IComponentSpecification spec = parseComponent("Parameter.jwc");
@@ -1040,8 +1089,7 @@
assertEquals(false, ps.getCache());
ps = spec.getParameter("withAliases");
- assertListsEqual(new String[]
- { "fred", "barney" }, ps.getAliasNames().toArray());
+ assertListsEqual(new String[] { "fred", "barney" }, ps.getAliasNames().toArray());
assertSame(ps, spec.getParameter("fred"));
assertSame(ps, spec.getParameter("barney"));
@@ -1051,12 +1099,13 @@
}
/**
- * Tests that assets read using the 3.0 DTD are converted properly into paths with the proper
- * prefix.
+ * Tests that assets read using the 3.0 DTD are converted properly into
+ * paths with the proper prefix.
*
* @since 4.0
*/
- public void testAssets_3_0() throws Exception
+ public void testAssets_3_0()
+ throws Exception
{
IComponentSpecification cs = parsePage("Assets_3_0.page");
@@ -1072,13 +1121,13 @@
assertEquals("http://myexternal/asset", as.getPath());
- assertListsEqual(new String[]
- { "mycontext", "myexternal", "myprivate" }, cs.getAssetNames());
+ assertListsEqual(new String[] { "mycontext", "myexternal", "myprivate" }, cs.getAssetNames());
}
/** @since 4.0 */
- public void testAssets() throws Exception
+ public void testAssets()
+ throws Exception
{
IComponentSpecification cs = parsePage("Assets.page");
@@ -1090,7 +1139,8 @@
/** @since 4.0 */
- public void testDeprecatedComponent() throws Exception
+ public void testDeprecatedComponent()
+ throws Exception
{
IComponentSpecification cs = parseComponent("DeprecatedComponent.jwc");
@@ -1099,7 +1149,8 @@
/** @since 4.0 */
- public void testLibrarySlashInComponentType() throws Exception
+ public void testLibrarySlashInComponentType()
+ throws Exception
{
ILibrarySpecification ls = parseLib("SlashInComponentType.library");
@@ -1114,7 +1165,8 @@
/** @since 4.0 */
- public void testComponentSlashInComponentType() throws Exception
+ public void testComponentSlashInComponentType()
+ throws Exception
{
IComponentSpecification cs = parseComponent("SlashInComponentType.jwc");
@@ -1122,4 +1174,4 @@
assertEquals("rubble/Barney", cc.getType());
}
-}
\ No newline at end of file
+}
Modified: jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/junit/parse/TestTemplateParser.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/junit/parse/TestTemplateParser.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/junit/parse/TestTemplateParser.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/junit/parse/TestTemplateParser.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -44,8 +44,11 @@
public class TestTemplateParser extends TestCase
{
+
+ /** Fixture. */
private static class ParserDelegate implements ITemplateParserDelegate
{
+
private final String _componentAttributeName;
public ParserDelegate()
@@ -79,8 +82,8 @@
}
}
- protected TemplateToken[] run(char[] templateData, ITemplateParserDelegate delegate,
- Resource location) throws TemplateParseException
+ protected TemplateToken[] run(char[] templateData, ITemplateParserDelegate delegate, Resource location)
+ throws TemplateParseException
{
TemplateParser parser = new TemplateParser();
@@ -89,8 +92,8 @@
return parser.parse(templateData, delegate, location);
}
- protected TemplateToken[] run(InputStream stream, ITemplateParserDelegate delegate,
- Resource location) throws TemplateParseException
+ protected TemplateToken[] run(InputStream stream, ITemplateParserDelegate delegate, Resource location)
+ throws TemplateParseException
{
StringBuffer buffer = new StringBuffer();
char[] block = new char[1000];
@@ -98,12 +101,11 @@
try
{
- while (true)
+ while(true)
{
int count = reader.read(block, 0, block.length);
- if (count < 0)
- break;
+ if (count < 0) break;
buffer.append(block, 0, count);
}
@@ -118,13 +120,14 @@
return run(buffer.toString().toCharArray(), delegate, location);
}
- protected TemplateToken[] run(String file) throws TemplateParseException
+ protected TemplateToken[] run(String file)
+ throws TemplateParseException
{
return run(file, new ParserDelegate());
}
protected TemplateToken[] run(String file, ITemplateParserDelegate delegate)
- throws TemplateParseException
+ throws TemplateParseException
{
String thisClassName = getClass().getName();
String thisPath = "/" + thisClassName.replace('.', '/') + "/" + file;
@@ -133,8 +136,7 @@
InputStream stream = getClass().getResourceAsStream(file);
- if (stream == null)
- throw new TemplateParseException("File " + file + " not found.");
+ if (stream == null) throw new TemplateParseException("File " + file + " not found.");
return run(stream, delegate, location);
}
@@ -143,18 +145,19 @@
{
Map result = new HashMap();
- for (int i = 0; i < input.length; i += 2)
+ for(int i = 0; i < input.length; i += 2)
result.put(input[i], input[i + 1]);
return result;
}
- // Note: the API of TextToken changed ... from startIndex/endIndex to offset/length.
+ // Note: the API of TextToken changed ... from startIndex/endIndex to
+ // offset/length.
// Rather than change *all* the tests, we'll just adjust here.
protected void assertTextToken(TemplateToken token, int startIndex, int endIndex)
{
- TextToken t = (TextToken) token;
+ TextToken t = (TextToken)token;
int expectedLength = endIndex - startIndex + 1;
@@ -174,7 +177,7 @@
protected void assertLocalizationToken(TemplateToken token, String key, Map attributes, int line)
{
- LocalizationToken t = (LocalizationToken) token;
+ LocalizationToken t = (LocalizationToken)token;
assertEquals("Localization token type.", TokenType.LOCALIZATION, t.getType());
assertEquals("Localization key.", key, t.getKey());
@@ -189,10 +192,9 @@
assertOpenToken(token, id, null, tag, line);
}
- protected void assertOpenToken(TemplateToken token, String id, String componentType,
- String tag, int line)
+ protected void assertOpenToken(TemplateToken token, String id, String componentType, String tag, int line)
{
- OpenToken t = (OpenToken) token;
+ OpenToken t = (OpenToken)token;
assertEquals("Open token type", TokenType.OPEN, t.getType());
assertEquals("Open token id", id, t.getId());
@@ -204,7 +206,7 @@
protected void assertTemplateAttributes(TemplateToken token, Map expected)
{
- OpenToken t = (OpenToken) token;
+ OpenToken t = (OpenToken)token;
assertEquals("Attributes", expected, t.getAttributesMap());
}
@@ -242,7 +244,8 @@
}
}
- public void testAllStatic() throws TemplateParseException
+ public void testAllStatic()
+ throws TemplateParseException
{
TemplateToken[] tokens = run("AllStatic.html");
@@ -250,7 +253,8 @@
assertTextToken(tokens[0], 0, 172);
}
- public void testSingleEmptyTag() throws TemplateParseException
+ public void testSingleEmptyTag()
+ throws TemplateParseException
{
TemplateToken[] tokens = run("SingleEmptyTag.html");
@@ -262,7 +266,8 @@
assertTextToken(tokens[3], 63, 102);
}
- public void testSimpleNested() throws TemplateParseException
+ public void testSimpleNested()
+ throws TemplateParseException
{
TemplateToken[] tokens = run("SimpleNested.html");
@@ -273,7 +278,8 @@
assertCloseToken(tokens[6], 5);
}
- public void testMixedNesting() throws TemplateParseException
+ public void testMixedNesting()
+ throws TemplateParseException
{
TemplateToken[] tokens = run("MixedNesting.html");
@@ -282,7 +288,8 @@
assertCloseToken(tokens[3], 7);
}
- public void testSingleQuotes() throws TemplateParseException
+ public void testSingleQuotes()
+ throws TemplateParseException
{
TemplateToken[] tokens = run("SingleQuotes.html");
@@ -291,7 +298,8 @@
assertOpenToken(tokens[4], "second", "span", 7);
}
- public void testComplex() throws TemplateParseException
+ public void testComplex()
+ throws TemplateParseException
{
TemplateToken[] tokens = run("Complex.html");
@@ -304,7 +312,8 @@
assertOpenToken(tokens[5], "row", "tr", 11);
}
- public void testStartWithStaticTag() throws TemplateParseException
+ public void testStartWithStaticTag()
+ throws TemplateParseException
{
TemplateToken[] tokens = run("StartWithStaticTag.html");
@@ -325,9 +334,7 @@
public void testMissingAttributeValueFailure()
{
- runFailure(
- "MissingAttributeValue.html",
- "Tag <img> on line 9 is missing a value for attribute src.");
+ runFailure("MissingAttributeValue.html", "Tag <img> on line 9 is missing a value for attribute src.");
}
public void testIncompleteCloseFailure()
@@ -337,15 +344,12 @@
public void testMismatchedCloseTagsFailure()
{
- runFailure(
- "MismatchedCloseTags.html",
- "Closing tag </th> on line 9 does not have a matching open tag.");
+ runFailure("MismatchedCloseTags.html", "Closing tag </th> on line 9 does not have a matching open tag.");
}
public void testInvalidDynamicNestingFailure()
{
- runFailure(
- "InvalidDynamicNesting.html",
+ runFailure("InvalidDynamicNesting.html",
"Closing tag </body> on line 12 is improperly nested with tag <span> on line 8.");
}
@@ -353,6 +357,7 @@
{
ITemplateParserDelegate delegate = new ITemplateParserDelegate()
{
+
public boolean getKnownComponent(String componentId)
{
return !componentId.equals("row");
@@ -374,13 +379,11 @@
}
};
- runFailure(
- "Complex.html",
- delegate,
- "Tag <tr> on line 11 references unknown component id 'row'.");
+ runFailure("Complex.html", delegate, "Tag <tr> on line 11 references unknown component id 'row'.");
}
- public void testBasicRemove() throws TemplateParseException
+ public void testBasicRemove()
+ throws TemplateParseException
{
TemplateToken[] tokens = run("BasicRemove.html");
@@ -397,10 +400,12 @@
assertTextToken(tokens[9], 391, 401);
}
- public void testBodyRemove() throws TemplateParseException
+ public void testBodyRemove()
+ throws TemplateParseException
{
ITemplateParserDelegate delegate = new ITemplateParserDelegate()
{
+
public boolean getKnownComponent(String id)
{
return true;
@@ -433,20 +438,18 @@
public void testRemovedComponentFailure()
{
- runFailure(
- "RemovedComponent.html",
+ runFailure("RemovedComponent.html",
"Tag <span> on line 5 is a dynamic component, and may not appear inside an ignored block.");
}
public void testNestedRemoveFailure()
{
- runFailure(
- "NestedRemove.html",
- "Tag <span> on line 4 should be ignored, but is already inside "
- + "an ignored block (ignored blocks may not be nested).");
+ runFailure("NestedRemove.html", "Tag <span> on line 4 should be ignored, but is already inside "
+ + "an ignored block (ignored blocks may not be nested).");
}
- public void testBasicContent() throws TemplateParseException
+ public void testBasicContent()
+ throws TemplateParseException
{
TemplateToken[] tokens = run("BasicContent.html");
@@ -459,20 +462,20 @@
public void testIgnoredContentFailure()
{
- runFailure(
- "IgnoredContent.html",
+ runFailure("IgnoredContent.html",
"Tag <td> on line 7 is the template content, and may not be in an ignored block.");
}
- public void testTagAttributes() throws TemplateParseException
+ public void testTagAttributes()
+ throws TemplateParseException
{
TemplateToken[] tokens = run("TagAttributes.html");
assertTokenCount(tokens, 5);
assertOpenToken(tokens[1], "tag", null, "span", 3);
- assertTemplateAttributes(tokens[1], buildMap(new String[]
- { "class", "zip", "align", "right", "color", "#ff00ff" }));
+ assertTemplateAttributes(tokens[1], buildMap(new String[] { "class", "zip", "align", "right", "color",
+ "#ff00ff" }));
}
@@ -480,7 +483,8 @@
* @since 2.0.4
*/
- public void testBasicLocalization() throws TemplateParseException
+ public void testBasicLocalization()
+ throws TemplateParseException
{
TemplateToken[] tokens = run("BasicLocalization.html");
@@ -498,22 +502,20 @@
public void testComponentInsideLocalization()
{
- runFailure(
- "ComponentInsideLocalization.html",
+ runFailure("ComponentInsideLocalization.html",
"Tag <span> on line 9 is a dynamic component, and may not appear inside an ignored block.");
}
/**
- * Test that the parser fails if an invisible localization is nested within another invisible
- * localization.
+ * Test that the parser fails if an invisible localization is nested within
+ * another invisible localization.
*
* @since 2.0.4
*/
public void testNestedLocalizations()
{
- runFailure(
- "NestedLocalizations.html",
+ runFailure("NestedLocalizations.html",
"Tag <span> on line 4 is a dynamic component, and may not appear inside an ignored block.");
}
@@ -523,7 +525,8 @@
* @since 2.0.4
*/
- public void testEmptyLocalization() throws TemplateParseException
+ public void testEmptyLocalization()
+ throws TemplateParseException
{
TemplateToken[] tokens = run("EmptyLocalization.html");
@@ -534,18 +537,18 @@
}
/**
- * Test attributes in the span. Also, checks that the parser caselessly identifies the "key"
- * attribute and the tag name ("span").
+ * Test attributes in the span. Also, checks that the parser caselessly
+ * identifies the "key" attribute and the tag name ("span").
*
* @since 2.0.4
*/
- public void testLocalizationAttributes() throws TemplateParseException
+ public void testLocalizationAttributes()
+ throws TemplateParseException
{
TemplateToken[] tokens = run("LocalizationAttributes.html");
- Map attributes = buildMap(new String[]
- { "alpha", "beta", "Fred", "Wilma" });
+ Map attributes = buildMap(new String[] { "alpha", "beta", "Fred", "Wilma" });
assertLocalizationToken(tokens[1], "localization.with.attributes", attributes, 3);
}
@@ -556,7 +559,8 @@
* @since 3.0
*/
- public void testImplicitComponents() throws TemplateParseException
+ public void testImplicitComponents()
+ throws TemplateParseException
{
TemplateToken[] tokens = run("ImplicitComponents.html");
@@ -565,18 +569,15 @@
assertOpenToken(tokens[1], "$Body", "Body", "body", 4);
assertOpenToken(tokens[3], "loop", "Foreach", "tr", 7);
- assertTemplateAttributes(tokens[3], buildMap(new String[]
- { "element", "tr", "source", "ognl:items" }));
+ assertTemplateAttributes(tokens[3], buildMap(new String[] { "element", "tr", "source", "ognl:items" }));
assertOpenToken(tokens[5], "$Insert", "Insert", "span", 10);
- assertTemplateAttributes(tokens[5], buildMap(new String[]
- { "value", "ognl:components.loop.value.name" }));
+ assertTemplateAttributes(tokens[5], buildMap(new String[] { "value", "ognl:components.loop.value.name" }));
assertOpenToken(tokens[8], "$Insert_0", "Insert", "span", 11);
- assertTemplateAttributes(tokens[8], buildMap(new String[]
- { "value", "ognl:components.loop.value.price" }));
+ assertTemplateAttributes(tokens[8], buildMap(new String[] { "value", "ognl:components.loop.value.price" }));
assertOpenToken(tokens[13], "$InspectorButton", "contrib:InspectorButton", "span", 15);
}
@@ -587,7 +588,8 @@
* @since 3.0
*/
- public void testEncodedExpressionCharacters() throws TemplateParseException
+ public void testEncodedExpressionCharacters()
+ throws TemplateParseException
{
TemplateToken[] tokens = run("EncodedExpressionCharacters.html");
@@ -597,8 +599,7 @@
String expression = "ognl: { \"<&>\", \"Fun!\" }";
- assertTemplateAttributes(tokens[0], buildMap(new String[]
- { "value", expression }));
+ assertTemplateAttributes(tokens[0], buildMap(new String[] { "value", expression }));
}
@@ -606,7 +607,8 @@
* Test ability to read string attributes.
*/
- public void testStringAttributes() throws TemplateParseException
+ public void testStringAttributes()
+ throws TemplateParseException
{
TemplateToken[] tokens = run("StringAttributes.html");
@@ -614,18 +616,20 @@
assertOpenToken(tokens[1], "$Image", "Image", "img", 2);
- assertTemplateAttributes(tokens[1], buildMap(new String[]
- { "image", "ognl:assets.logo", "alt", "message:logo-title" }));
+ assertTemplateAttributes(tokens[1], buildMap(new String[] { "image", "ognl:assets.logo", "alt",
+ "message:logo-title" }));
}
/**
- * Test ability to use a different attribute name than the default ("jwcid").
+ * Test ability to use a different attribute name than the default
+ * ("jwcid").
*
* @since 4.0
*/
- public void testOverrideDefaultAttributeName() throws Exception
+ public void testOverrideDefaultAttributeName()
+ throws Exception
{
TemplateToken[] tokens = run("OverrideDefaultAttributeName.html", new ParserDelegate("id"));
@@ -637,11 +641,12 @@
}
/**
- * Like {@link #testOverrideDefaultAttributeName()}, but uses a more complicated attribute name
- * (with a XML-style namespace prefix).
+ * Like {@link #testOverrideDefaultAttributeName()}, but uses a more
+ * complicated attribute name (with a XML-style namespace prefix).
*/
- public void testNamespaceAttributeName() throws Exception
+ public void testNamespaceAttributeName()
+ throws Exception
{
TemplateToken[] tokens = run("NamespaceAttributeName.html", new ParserDelegate("t:id"));
@@ -655,34 +660,32 @@
/** @since 4.0 */
public void testDuplicateTagAttributeFailure()
{
- runFailure(
- "DuplicateTagAttribute.html",
- "Tag <input> on line 3 contains more than one 'value' attribute.");
+ runFailure("DuplicateTagAttribute.html", "Tag <input> on line 3 contains more than one 'value' attribute.");
}
/** @since 4.0 */
public void testDuplicateTagAttributeFailureSingleQuotes()
{
- runFailure(
- "DuplicateTagAttributeSingleQuotes.html",
+ runFailure("DuplicateTagAttributeSingleQuotes.html",
"Tag <input> on line 3 contains more than one 'value' attribute.");
}
/** @since 4.0 */
- public void testSlashInComponentType() throws Exception
+ public void testSlashInComponentType()
+ throws Exception
{
TemplateToken[] tokens = run("SlashInComponentType.html", new ParserDelegate());
assertEquals(6, tokens.length);
- OpenToken token1 = (OpenToken) tokens[1];
+ OpenToken token1 = (OpenToken)tokens[1];
assertEquals("$foo$Bar", token1.getId());
assertEquals("foo/Bar", token1.getComponentType());
- OpenToken token2 = (OpenToken) tokens[4];
+ OpenToken token2 = (OpenToken)tokens[4];
assertEquals("baz", token2.getId());
assertEquals("biff/bop/Boop", token2.getComponentType());
}
-}
\ No newline at end of file
+}
Modified: jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/junit/script/TestScript.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/junit/script/TestScript.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/junit/script/TestScript.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/junit/script/TestScript.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -44,6 +44,7 @@
public class TestScript extends TapestryTestCase
{
+
private MockScriptProcessor _processor = new MockScriptProcessor();
protected static ExpressionEvaluator createExpressionEvaluator()
@@ -55,7 +56,7 @@
return result;
}
- private IScript read(String file) throws DocumentParseException
+ private IScript read(String file)
{
ClassResolver resolver = new DefaultClassResolver();
ScriptParser parser = new ScriptParser(resolver, createExpressionEvaluator(), null);
@@ -68,11 +69,11 @@
return parser.parse(scriptLocation);
}
- private IScript execute(String file, Map symbols) throws DocumentParseException
+ private IScript execute(String file, Map symbols)
{
IScript script = read(file);
- IRequestCycle cycle = (IRequestCycle) newMock(IRequestCycle.class);
+ IRequestCycle cycle = (IRequestCycle)newMock(IRequestCycle.class);
replayControls();
@@ -94,7 +95,8 @@
* Simple test where the body and initialization are static.
*/
- public void testSimple() throws Exception
+ public void testSimple()
+ throws Exception
{
execute("simple.script", null);
@@ -104,12 +106,13 @@
}
/**
- * Test the <unique> element, new in the 1.3 DTD
+ * Test the <unique> element, new in the 1.3 DTD.
*
* @since 3.0
*/
- public void testUnique() throws Exception
+ public void testUnique()
+ throws Exception
{
IScript script = read("unique.script");
@@ -125,7 +128,8 @@
* Test omitting body and initialization, ensure they return null.
*/
- public void testEmpty() throws Exception
+ public void testEmpty()
+ throws Exception
{
execute("empty.script", null);
@@ -134,11 +138,12 @@
}
/**
- * Test the ability of the let element to create an output symbol. Also, test the insert
- * element.
+ * Test the ability of the let element to create an output symbol. Also,
+ * test the insert element.
*/
- public void testLet() throws Exception
+ public void testLet()
+ throws Exception
{
String inputSymbol = Long.toHexString(System.currentTimeMillis());
Map symbols = new HashMap();
@@ -158,7 +163,8 @@
*
* @since 3.0
*/
- public void testUniqueLet() throws Exception
+ public void testUniqueLet()
+ throws Exception
{
Map symbols = new HashMap();
@@ -169,22 +175,21 @@
assertSymbol(symbols, "gamma", "Alpha_1");
}
- public void testIncludeScript() throws Exception
+ public void testIncludeScript()
+ throws Exception
{
IScript script = execute("include-script.script", null);
Resource scriptLocation = script.getScriptResource();
- Resource[] expected = new Resource[]
- { scriptLocation.getRelativeResource("first"),
- scriptLocation.getRelativeResource("second"),
- scriptLocation.getRelativeResource("third") };
+ Resource[] expected = new Resource[] { scriptLocation.getRelativeResource("first"),
+ scriptLocation.getRelativeResource("second"), scriptLocation.getRelativeResource("third") };
- assertEquals("included scripts", Arrays.asList(expected), Arrays.asList(_processor
- .getExternalScripts()));
+ assertEquals("included scripts", Arrays.asList(expected), Arrays.asList(_processor.getExternalScripts()));
}
- public void testAntSyntax() throws Exception
+ public void testAntSyntax()
+ throws Exception
{
Map form = new HashMap();
@@ -206,7 +211,8 @@
assertSymbol(symbols, "OGNL", "This is a brace: }.");
}
- public void testSet() throws Exception
+ public void testSet()
+ throws Exception
{
Map symbols = new HashMap();
@@ -215,7 +221,8 @@
assertSymbol(symbols, "element2", new Character('p'));
}
- public void testInvalidKeyLet() throws Exception
+ public void testInvalidKeyLet()
+ throws Exception
{
try
{
@@ -229,7 +236,8 @@
}
}
- public void testInvalidKeySet() throws Exception
+ public void testInvalidKeySet()
+ throws Exception
{
try
{
@@ -243,7 +251,8 @@
}
}
- public void testInputSymbolClass() throws Exception
+ public void testInputSymbolClass()
+ throws Exception
{
try
{
@@ -261,7 +270,8 @@
}
}
- public void testInputSymbol() throws Exception
+ public void testInputSymbol()
+ throws Exception
{
Map symbols = new HashMap();
symbols.put("input", new Long(20));
@@ -271,7 +281,8 @@
assertSymbol(symbols, "success", "Success");
}
- public void testInputSymbolRequired() throws Exception
+ public void testInputSymbolRequired()
+ throws Exception
{
try
{
@@ -285,7 +296,8 @@
}
}
- public void testInputSymbolInvalidKey() throws Exception
+ public void testInputSymbolInvalidKey()
+ throws Exception
{
try
{
@@ -302,7 +314,8 @@
/** @since 3.0 */
- public void testNameAppend() throws Exception
+ public void testNameAppend()
+ throws Exception
{
Map symbols = new HashMap();
@@ -315,7 +328,8 @@
/**
* A bunch of quickies to push up the code coverage numbers.
*/
- public void testCheats() throws Exception
+ public void testCheats()
+ throws Exception
{
IScript script = execute("simple.script", null);
@@ -323,4 +337,4 @@
createExpressionEvaluator(), null, null);
assertEquals("ScriptSession[" + script.getScriptResource() + "]", session.toString());
}
-}
\ No newline at end of file
+}
Modified: jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/junit/spec/ImmediateExtension.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/junit/spec/ImmediateExtension.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/junit/spec/ImmediateExtension.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/junit/spec/ImmediateExtension.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@
public class ImmediateExtension
{
+
private static int _instanceCount = 0;
public static int getInstanceCount()
@@ -34,4 +35,9 @@
{
_instanceCount++;
}
-}
\ No newline at end of file
+
+ public String toString()
+ {
+ return Integer.toString(_instanceCount);
+ }
+}
Modified: jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/junit/utils/StringHolder.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/junit/utils/StringHolder.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/junit/utils/StringHolder.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/junit/utils/StringHolder.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2005 The Apache Software Foundation
+// Copyright 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -16,11 +16,18 @@
import java.io.Serializable;
+/**
+ * Used when testing the data squeezer.
+ *
+ * @author Howard M. Lewis Ship
+ * @since 4.0
+ */
public class StringHolder implements Serializable
{
+
private static final long serialVersionUID = 2681665795452343714L;
-
- private String _string;
+
+ private String _string;
public StringHolder(String string)
{
@@ -34,6 +41,6 @@
public boolean equals(Object other)
{
- return ((StringHolder) other)._string.equals(_string);
+ return ((StringHolder)other)._string.equals(_string);
}
}
Modified: jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/junit/utils/TestDataSqueezer.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/junit/utils/TestDataSqueezer.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/junit/utils/TestDataSqueezer.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/junit/utils/TestDataSqueezer.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -45,6 +45,7 @@
public class TestDataSqueezer extends TestCase
{
+
private DataSqueezerImpl ds = DataSqueezerUtil.createUnitTestSqueezer();
public TestDataSqueezer(String name)
@@ -82,9 +83,9 @@
public void testByte()
{
- attempt(new Byte((byte) 0), "b0");
- attempt(new Byte((byte) -5), "b-5");
- attempt(new Byte((byte) 72), "b72");
+ attempt(new Byte((byte)0), "b0");
+ attempt(new Byte((byte)-5), "b-5");
+ attempt(new Byte((byte)72), "b72");
}
public void testFloat()
@@ -111,15 +112,15 @@
public void testLong()
{
attempt(new Long(0), "l0");
- attempt(new Long(800400300l), "l800400300");
- attempt(new Long(-987654321l), "l-987654321");
+ attempt(new Long(800400300L), "l800400300");
+ attempt(new Long(-987654321L), "l-987654321");
}
public void testShort()
{
- attempt(new Short((short) 0), "s0");
- attempt(new Short((short) -10), "s-10");
- attempt(new Short((short) 57), "s57");
+ attempt(new Short((short)0), "s0");
+ attempt(new Short((short)-10), "s-10");
+ attempt(new Short((short)57), "s57");
}
/** @since 2.2 * */
@@ -139,8 +140,7 @@
public void testComponentAddress()
{
- ComponentAddress objAddress = new ComponentAddress("framework:DirectLink",
- "component.subcomponent");
+ ComponentAddress objAddress = new ComponentAddress("framework:DirectLink", "component.subcomponent");
attempt(objAddress, "Aframework:DirectLink,component.subcomponent");
objAddress = new ComponentAddress("framework:DirectLink", null);
@@ -149,8 +149,7 @@
public void testArray()
{
- Object[] input =
- { new Short((short) -82), "Time to encode an array.", new Long(38383833273789l), null,
+ Object[] input = { new Short((short)-82), "Time to encode an array.", new Long(38383833273789L), null,
Boolean.TRUE, new Double(22. / 7.) };
String[] encoded = ds.squeeze(input);
@@ -161,7 +160,7 @@
assertEquals("Output array length.", input.length, output.length);
- for (int i = 0; i < input.length; i++)
+ for(int i = 0; i < input.length; i++)
{
assertEquals(input[i], output[i]);
}
@@ -201,14 +200,15 @@
map.put("alpha", Boolean.TRUE);
map.put("beta", new StringHolder("FredFlintstone"));
- map.put("gamma", new BigDecimal(
- "2590742358742358972.234592348957230948578975248972390857490725"));
+ map.put("gamma", new BigDecimal("2590742358742358972.234592348957230948578975248972390857490725"));
- attempt((Serializable) map, ds);
+ attempt((Serializable)map, ds);
}
+ /** Test fixture. */
public static class BooleanHolder
{
+
private boolean value;
public BooleanHolder()
@@ -232,31 +232,30 @@
public boolean equals(Object other)
{
- if (other == null)
- return false;
+ if (other == null) return false;
- if (this == other)
- return true;
+ if (this == other) return true;
- if (!(other instanceof BooleanHolder))
- return false;
+ if (!(other instanceof BooleanHolder)) return false;
- BooleanHolder otherHolder = (BooleanHolder) other;
+ BooleanHolder otherHolder = (BooleanHolder)other;
return value == otherHolder.value;
}
}
+ /** Test fixture. */
public static class BHSqueezer implements SqueezeAdaptor
{
- private final String prefix_;
-
- private final Class dataClass_;
private static final String TRUE = "BT";
private static final String FALSE = "BF";
+ private final String _prefix;
+
+ private final Class _dataClass;
+
public BHSqueezer()
{
this("B", BooleanHolder.class);
@@ -269,34 +268,32 @@
public BHSqueezer(String prefix, Class dataClass)
{
- prefix_ = prefix;
- dataClass_ = dataClass;
+ _prefix = prefix;
+ _dataClass = dataClass;
}
public String getPrefix()
{
- return prefix_;
+ return _prefix;
}
public Class getDataClass()
{
- return dataClass_;
+ return _dataClass;
}
public String squeeze(DataSqueezer squeezer, Object data)
{
- BooleanHolder h = (BooleanHolder) data;
+ BooleanHolder h = (BooleanHolder)data;
return h.getValue() ? TRUE : FALSE;
}
public Object unsqueeze(DataSqueezer squeezer, String string)
{
- if (string.equals(TRUE))
- return new BooleanHolder(true);
+ if (string.equals(TRUE)) return new BooleanHolder(true);
- if (string.equals(FALSE))
- return new BooleanHolder(false);
+ if (string.equals(FALSE)) return new BooleanHolder(false);
throw new ApplicationRuntimeException("Unexpected value.");
}
@@ -379,12 +376,12 @@
}
}
- public void testClassLoader() throws Exception
+ public void testClassLoader()
+ throws Exception
{
File tempDir = new File(System.getProperty("java.io.tmpdir"));
File projectRoot = new File(tempDir, "jakarta-tapestry");
- File springJAR = new File(projectRoot,
- "tapestry/target/module-lib/test-subject/spring/spring-1.1.jar");
+ File springJAR = new File(projectRoot, "tapestry/target/module-lib/test-subject/spring/spring-1.1.jar");
if (!springJAR.exists())
throw new RuntimeException("File " + springJAR
@@ -393,11 +390,9 @@
ClassResolver resolver = newClassResolver(springJAR);
Class propertyValueClass = resolver.findClass("org.springframework.beans.PropertyValue");
- Constructor constructor = propertyValueClass.getConstructor(new Class[]
- { String.class, Object.class });
+ Constructor constructor = propertyValueClass.getConstructor(new Class[] { String.class, Object.class });
- Serializable instance = (Serializable) constructor.newInstance(new Object[]
- { "fred", "flintstone" });
+ Serializable instance = (Serializable)constructor.newInstance(new Object[] { "fred", "flintstone" });
assertEquals("fred", PropertyUtils.read(instance, "name"));
assertEquals("flintstone", PropertyUtils.read(instance, "value"));
@@ -419,10 +414,10 @@
assertEquals("flintstone", PropertyUtils.read(output, "value"));
}
- private ClassResolver newClassResolver(File jarFile) throws Exception
+ private ClassResolver newClassResolver(File jarFile)
+ throws Exception
{
- URLClassLoader classLoader = new URLClassLoader(new URL[]
- { jarFile.toURL() });
+ URLClassLoader classLoader = new URLClassLoader(new URL[] { jarFile.toURL() });
return new DefaultClassResolver(classLoader);
@@ -437,4 +432,4 @@
retval.register(adaptor);
return retval;
}
-}
\ No newline at end of file
+}
Modified: jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/junit/utils/TestRegexpMatcher.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/junit/utils/TestRegexpMatcher.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/junit/utils/TestRegexpMatcher.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/junit/utils/TestRegexpMatcher.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -104,8 +104,7 @@
String[] matches = m.getMatches("\\d+", "57,232 89 147", 0);
- assertListsEqual(new String[]
- { "57", "232", "89", "147" }, matches);
+ assertListsEqual(new String[] { "57", "232", "89", "147" }, matches);
}
/** @since 4.0 */
@@ -117,15 +116,15 @@
RegexpMatch[] matches = m.getMatches("\\w+(=(\\w+))?", "fred,barney=rubble;wilma=flintstone");
assertEquals(3, matches.length);
-
+
assertEquals("fred", matches[0].getInput());
assertEquals("fred", matches[0].getGroup(0));
-
+
assertEquals("barney=rubble", matches[1].getInput());
assertEquals("rubble", matches[1].getGroup(2));
-
+
assertEquals("wilma=flintstone", matches[2].getInput());
- assertEquals("flintstone", matches[2].getGroup(2));
+ assertEquals("flintstone", matches[2].getGroup(2));
}
/** @since 4.0 */
@@ -145,10 +144,9 @@
{
RegexpMatcher m = new RegexpMatcher();
- String matches[] = m.getMatches("A(B|C|fred)", "AA AC AB Afred AA AC", 1);
+ String[] matches = m.getMatches("A(B|C|fred)", "AA AC AB Afred AA AC", 1);
- assertListsEqual(new String[]
- { "C", "B", "fred", "C" }, matches);
+ assertListsEqual(new String[] { "C", "B", "fred", "C" }, matches);
}
}
Modified: jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/link/DefaultLinkRendererTest.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/link/DefaultLinkRendererTest.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/link/DefaultLinkRendererTest.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/link/DefaultLinkRendererTest.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2005 The Apache Software Foundation
+// Copyright 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -32,6 +32,7 @@
*/
public class DefaultLinkRendererTest extends BaseComponentTestCase
{
+ /** Test fixture. */
class RendererFixture extends DefaultLinkRenderer
{
private IMarkupWriter _writer;
Modified: jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/listener/TestListenerMapSource.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/listener/TestListenerMapSource.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/listener/TestListenerMapSource.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/listener/TestListenerMapSource.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2005 The Apache Software Foundation
+// Copyright 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -32,10 +32,11 @@
*/
public class TestListenerMapSource extends HiveMindTestCase
{
+
private IRequestCycle newCycle(Object[] listenerParameters)
{
MockControl control = newControl(IRequestCycle.class);
- IRequestCycle cycle = (IRequestCycle) control.getMock();
+ IRequestCycle cycle = (IRequestCycle)control.getMock();
cycle.getListenerParameters();
control.setReturnValue(listenerParameters);
@@ -47,10 +48,9 @@
{
Method[] methods = clazz.getMethods();
- for (int i = 0; i < methods.length; i++)
+ for(int i = 0; i < methods.length; i++)
{
- if (methods[i].getName().equals(name))
- return methods[i];
+ if (methods[i].getName().equals(name)) return methods[i];
}
throw new IllegalArgumentException("No method '" + name + "' in " + clazz + ".");
@@ -79,8 +79,7 @@
public void testFoundWithParameters()
{
- IRequestCycle cycle = newCycle(new Object[]
- { "Hello", new Integer(7) });
+ IRequestCycle cycle = newCycle(new Object[] { "Hello", new Integer(7) });
ListenerMethodHolder holder = newHolder();
holder.fred("Hello", 7);
@@ -98,8 +97,7 @@
public void testFoundWithCycleAndParameters()
{
- IRequestCycle cycle = newCycle(new Object[]
- { new Integer(7) });
+ IRequestCycle cycle = newCycle(new Object[] { new Integer(7) });
ListenerMethodHolder holder = newHolder();
holder.wilma(cycle, 7);
@@ -116,13 +114,13 @@
}
/**
- * No exact match on parameter count, fall through to the no-arguments method implementation.
+ * No exact match on parameter count, fall through to the no-arguments
+ * method implementation.
*/
public void testNoParameterMatch()
{
- IRequestCycle cycle = newCycle(new Object[]
- { "Hello", new Integer(7) });
+ IRequestCycle cycle = newCycle(new Object[] { "Hello", new Integer(7) });
ListenerMethodHolder holder = newHolder();
holder.barney();
@@ -140,8 +138,7 @@
public void testFallbackToJustCycle()
{
- IRequestCycle cycle = newCycle(new Object[]
- { "Hello", new Integer(7) });
+ IRequestCycle cycle = newCycle(new Object[] { "Hello", new Integer(7) });
ListenerMethodHolder holder = newHolder();
@@ -179,13 +176,13 @@
public void testReturnLink()
{
ILink link = newLink("http://foo/bar");
-
+
IRequestCycle cycle = newCycle(null);
-
+
cycle.sendRedirect("http://foo/bar");
-
+
ListenerMethodHolder holder = new ListenerMethodHolder(link);
-
+
replayControls();
ListenerMapSource source = new ListenerMapSourceImpl();
@@ -194,13 +191,13 @@
map.getListener("returnsLink").actionTriggered(null, cycle);
- verifyControls();
+ verifyControls();
}
private ILink newLink(String absoluteURL)
{
MockControl control = newControl(ILink.class);
- ILink link = (ILink) control.getMock();
+ ILink link = (ILink)control.getMock();
link.getAbsoluteURL();
control.setReturnValue(absoluteURL);
@@ -210,7 +207,7 @@
public void testReturnPageInstance()
{
- IPage page = (IPage) newMock(IPage.class);
+ IPage page = (IPage)newMock(IPage.class);
IRequestCycle cycle = newCycle(null);
ListenerMethodHolder holder = new ListenerMethodHolder(page);
@@ -229,8 +226,7 @@
public void testNoMatch()
{
- IRequestCycle cycle = newCycle(new Object[]
- { "Hello", new Integer(7) });
+ IRequestCycle cycle = newCycle(new Object[] { "Hello", new Integer(7) });
replayControls();
@@ -258,8 +254,7 @@
public void testMismatchedTypes()
{
- IRequestCycle cycle = newCycle(new Object[]
- { "Hello" });
+ IRequestCycle cycle = newCycle(new Object[] { "Hello" });
replayControls();
@@ -276,14 +271,15 @@
}
catch (ApplicationRuntimeException ex)
{
- assertEquals(IllegalArgumentException.class,
- ex.getRootCause().getClass());
- assertTrue(ex.getMessage()
- .startsWith("Failure invoking listener method 'public void "
- + "org.apache.tapestry.listener.ListenerMethodHolder."
- + "wrongTypes(java.util.Map)' on ListenerMethodHolder:"));
- //TODO: IBM jre doesn't format these messages the same as sun's jre,
- //IBM's message has no message string source for the IllegalArgumentException
+ assertEquals(IllegalArgumentException.class, ex.getRootCause().getClass());
+ assertTrue(ex.getMessage().startsWith(
+ "Failure invoking listener method 'public void "
+ + "org.apache.tapestry.listener.ListenerMethodHolder."
+ + "wrongTypes(java.util.Map)' on ListenerMethodHolder:"));
+ // TODO: IBM jre doesn't format these messages the same as sun's
+ // jre,
+ // IBM's message has no message string source for the
+ // IllegalArgumentException
assertSame(holder, ex.getComponent());
}
@@ -292,8 +288,7 @@
public void testInvocationTargetException()
{
- IRequestCycle cycle = newCycle(new Object[]
- { "Hello", new Integer(7) });
+ IRequestCycle cycle = newCycle(new Object[] { "Hello", new Integer(7) });
ListenerMethodHolder holder = new ListenerMethodHolder();
@@ -326,8 +321,7 @@
public void testInvocationTargetExceptionForApplicationRuntimeException()
{
- IRequestCycle cycle = newCycle(new Object[]
- { "Hello", new Integer(7) });
+ IRequestCycle cycle = newCycle(new Object[] { "Hello", new Integer(7) });
ListenerMethodHolder holder = new ListenerMethodHolder();
@@ -356,6 +350,6 @@
private ListenerMethodHolder newHolder()
{
- return (ListenerMethodHolder) newMock(ListenerMethodHolder.class);
+ return (ListenerMethodHolder)newMock(ListenerMethodHolder.class);
}
-}
\ No newline at end of file
+}
Modified: jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/markup/TestMarkupWriter.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/markup/TestMarkupWriter.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/markup/TestMarkupWriter.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/markup/TestMarkupWriter.java Wed Jan 11 16:47:57 2006
@@ -33,7 +33,8 @@
private static final String NEWLINE = System.getProperty("line.separator");
- private static class EchoMarkupFilter implements MarkupFilter
+ /** Test fixture. */
+ private static class EchoMarkupFilter implements MarkupFilter
{
public void print(PrintWriter writer, char[] data, int offset, int length,
boolean escapeQuotes)
@@ -44,7 +45,8 @@
}
}
- public static class PrintWriterFixture extends PrintWriter
+ /** Test fixture. */
+ public static class PrintWriterFixture extends PrintWriter
{
public PrintWriterFixture()
Modified: jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/multipart/TestMultipartDecoderFilter.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/multipart/TestMultipartDecoderFilter.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/multipart/TestMultipartDecoderFilter.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/multipart/TestMultipartDecoderFilter.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2005 The Apache Software Foundation
+// Copyright 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -32,12 +32,15 @@
*/
public class TestMultipartDecoderFilter extends HiveMindTestCase
{
+
+ /** Test fixture. */
private static class MockServicer implements ServletRequestServicer
{
+
HttpServletRequest _request;
public void service(HttpServletRequest request, HttpServletResponse response)
- throws IOException, ServletException
+ throws IOException, ServletException
{
_request = request;
}
@@ -46,7 +49,7 @@
private HttpServletRequest newRequest(String contentType)
{
MockControl control = newControl(HttpServletRequest.class);
- HttpServletRequest request = (HttpServletRequest) control.getMock();
+ HttpServletRequest request = (HttpServletRequest)control.getMock();
request.getContentType();
control.setReturnValue(contentType);
@@ -56,10 +59,11 @@
private HttpServletResponse newResponse()
{
- return (HttpServletResponse) newMock(HttpServletResponse.class);
+ return (HttpServletResponse)newMock(HttpServletResponse.class);
}
- public void testNormalRequest() throws Exception
+ public void testNormalRequest()
+ throws Exception
{
HttpServletRequest request = newRequest("application/x-www-form-urlencoded");
HttpServletResponse response = newResponse();
@@ -77,14 +81,15 @@
verifyControls();
}
- public void testUploadRequest() throws Exception
+ public void testUploadRequest()
+ throws Exception
{
HttpServletRequest request = newRequest("multipart/form-data");
HttpServletResponse response = newResponse();
- HttpServletRequest decoded = (HttpServletRequest) newMock(HttpServletRequest.class);
+ HttpServletRequest decoded = (HttpServletRequest)newMock(HttpServletRequest.class);
MockControl control = newControl(MultipartDecoder.class);
- MultipartDecoder decoder = (MultipartDecoder) control.getMock();
+ MultipartDecoder decoder = (MultipartDecoder)control.getMock();
decoder.decode(request);
control.setReturnValue(decoded);
@@ -104,4 +109,4 @@
verifyControls();
}
-}
\ No newline at end of file
+}
Modified: jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/multipart/TestUploadFormParametersWrapper.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/multipart/TestUploadFormParametersWrapper.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/multipart/TestUploadFormParametersWrapper.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/multipart/TestUploadFormParametersWrapper.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2005 The Apache Software Foundation
+// Copyright 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -30,9 +30,10 @@
*/
public class TestUploadFormParametersWrapper extends HiveMindTestCase
{
+
private HttpServletRequest newRequest()
{
- return (HttpServletRequest) newMock(HttpServletRequest.class);
+ return (HttpServletRequest)newMock(HttpServletRequest.class);
}
public void testMapIsNotModifiable()
@@ -43,8 +44,7 @@
Map map = new HashMap();
- map.put("key", new String[]
- { "value" });
+ map.put("key", new String[] { "value" });
HttpServletRequest r = new UploadFormParametersWrapper(request, map);
@@ -99,8 +99,7 @@
public void testGetParameterValues()
{
- String[] values =
- { "fred", "barney" };
+ String[] values = { "fred", "barney" };
HttpServletRequest request = newRequest();
@@ -137,4 +136,4 @@
verifyControls();
}
-}
\ No newline at end of file
+}
Modified: jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/request/TestDecodedRequestInjector.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/request/TestDecodedRequestInjector.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/request/TestDecodedRequestInjector.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/request/TestDecodedRequestInjector.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2005 The Apache Software Foundation
+// Copyright 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -34,12 +34,15 @@
*/
public class TestDecodedRequestInjector extends HiveMindTestCase
{
+
+ /** Test fixture. */
private static class ServicerFixture implements ServletRequestServicer
{
+
HttpServletRequest _request;
public void service(HttpServletRequest request, HttpServletResponse response)
- throws IOException, ServletException
+ throws IOException, ServletException
{
_request = request;
}
@@ -47,18 +50,18 @@
private HttpServletRequest newRequest()
{
- return (HttpServletRequest) newMock(HttpServletRequest.class);
+ return (HttpServletRequest)newMock(HttpServletRequest.class);
}
private HttpServletResponse newResponse()
{
- return (HttpServletResponse) newMock(HttpServletResponse.class);
+ return (HttpServletResponse)newMock(HttpServletResponse.class);
}
private ILibrarySpecification newSpec(boolean exists, IRequestDecoder decoder)
{
MockControl control = newControl(ILibrarySpecification.class);
- ILibrarySpecification spec = (ILibrarySpecification) control.getMock();
+ ILibrarySpecification spec = (ILibrarySpecification)control.getMock();
spec.checkExtension(Tapestry.REQUEST_DECODER_EXTENSION_NAME);
control.setReturnValue(exists);
@@ -72,13 +75,14 @@
return spec;
}
- public void testNoExtension() throws Exception
+ public void testNoExtension()
+ throws Exception
{
HttpServletRequest request = newRequest();
HttpServletResponse response = newResponse();
ILibrarySpecification spec = newSpec(false, null);
- ServletRequestServicer servicer = (ServletRequestServicer) newMock(ServletRequestServicer.class);
+ ServletRequestServicer servicer = (ServletRequestServicer)newMock(ServletRequestServicer.class);
servicer.service(request, response);
@@ -94,13 +98,14 @@
verifyControls();
}
- public void testWithExtension() throws Exception
+ public void testWithExtension()
+ throws Exception
{
HttpServletRequest request = newRequest();
HttpServletResponse response = newResponse();
MockControl decoderc = newControl(IRequestDecoder.class);
- IRequestDecoder decoder = (IRequestDecoder) decoderc.getMock();
+ IRequestDecoder decoder = (IRequestDecoder)decoderc.getMock();
ILibrarySpecification spec = newSpec(true, decoder);
ServicerFixture servicer = new ServicerFixture();
@@ -126,4 +131,4 @@
verifyControls();
}
-}
\ No newline at end of file
+}
Modified: jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/request/TestRequestContext.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/request/TestRequestContext.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/request/TestRequestContext.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/request/TestRequestContext.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2005 The Apache Software Foundation
+// Copyright 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -34,15 +34,16 @@
*/
public class TestRequestContext extends HiveMindTestCase
{
+
private HttpSession newSession()
{
- return (HttpSession) newMock(HttpSession.class);
+ return (HttpSession)newMock(HttpSession.class);
}
private HttpServletRequest newRequest(boolean create, HttpSession session)
{
MockControl control = newControl(HttpServletRequest.class);
- HttpServletRequest request = (HttpServletRequest) control.getMock();
+ HttpServletRequest request = (HttpServletRequest)control.getMock();
request.getSession(create);
control.setReturnValue(session);
@@ -52,18 +53,18 @@
private HttpServletRequest newRequest()
{
- return (HttpServletRequest) newMock(HttpServletRequest.class);
+ return (HttpServletRequest)newMock(HttpServletRequest.class);
}
private HttpServletResponse newResponse()
{
- return (HttpServletResponse) newMock(HttpServletResponse.class);
+ return (HttpServletResponse)newMock(HttpServletResponse.class);
}
public void testGetParameter()
{
MockControl control = newControl(HttpServletRequest.class);
- HttpServletRequest request = (HttpServletRequest) control.getMock();
+ HttpServletRequest request = (HttpServletRequest)control.getMock();
HttpServletResponse response = newResponse();
String value = "VALUE";
@@ -83,11 +84,10 @@
public void testGetParameters()
{
MockControl control = newControl(HttpServletRequest.class);
- HttpServletRequest request = (HttpServletRequest) control.getMock();
+ HttpServletRequest request = (HttpServletRequest)control.getMock();
HttpServletResponse response = newResponse();
- String[] values =
- { "this", "that" };
+ String[] values = { "this", "that" };
request.getParameterValues("myparam");
control.setReturnValue(values);
@@ -104,7 +104,7 @@
public void testGetParameterNames()
{
MockControl control = newControl(HttpServletRequest.class);
- HttpServletRequest request = (HttpServletRequest) control.getMock();
+ HttpServletRequest request = (HttpServletRequest)control.getMock();
HttpServletResponse response = newResponse();
List names = new ArrayList();
@@ -122,8 +122,7 @@
String[] pnames = rc.getParameterNames();
- assertListsEqual(new String[]
- { "fred", "barney" }, pnames);
+ assertListsEqual(new String[] { "fred", "barney" }, pnames);
verifyControls();
}
@@ -146,7 +145,7 @@
public void testGetAttribute()
{
MockControl control = newControl(HttpServletRequest.class);
- HttpServletRequest request = (HttpServletRequest) control.getMock();
+ HttpServletRequest request = (HttpServletRequest)control.getMock();
HttpServletResponse response = newResponse();
Object attribute = new Object();
@@ -192,4 +191,4 @@
verifyControls();
}
-}
\ No newline at end of file
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org