hlship 2005/07/30 07:21:51
Modified: annotations/src/test/org/apache/tapestry/annotations
TestParameterAnnotationWorker.java
AnnotatedPage.java
Added: annotations/src/test/org/apache/tapestry/annotations
TestAnnotationLocation.java
Log:
Fill in some gaps in the annotations code coverage.
Revision Changes Path
1.5 +8 -0
jakarta-tapestry/annotations/src/test/org/apache/tapestry/annotations/TestParameterAnnotationWorker.java
Index: TestParameterAnnotationWorker.java
===================================================================
RCS file:
/home/cvs/jakarta-tapestry/annotations/src/test/org/apache/tapestry/annotations/TestParameterAnnotationWorker.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TestParameterAnnotationWorker.java 28 Jul 2005 19:12:11 -0000
1.4
+++ TestParameterAnnotationWorker.java 30 Jul 2005 14:21:51 -0000
1.5
@@ -110,4 +110,12 @@
assertEquals("fred", ps.getParameterName());
assertEquals("namedParameter", ps.getPropertyName());
}
+
+ public void testDefaultValue()
+ {
+ IParameterSpecification ps = attempt("defaultValue", null);
+
+ assertEquals("myDefault", ps.getDefaultValue());
+ }
+
}
1.10 +3 -0
jakarta-tapestry/annotations/src/test/org/apache/tapestry/annotations/AnnotatedPage.java
Index: AnnotatedPage.java
===================================================================
RCS file:
/home/cvs/jakarta-tapestry/annotations/src/test/org/apache/tapestry/annotations/AnnotatedPage.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- AnnotatedPage.java 28 Jul 2005 19:12:11 -0000 1.9
+++ AnnotatedPage.java 30 Jul 2005 14:21:51 -0000 1.10
@@ -86,6 +86,9 @@
@Parameter(name = "fred")
public abstract double getNamedParameter();
+
+ @Parameter(defaultValue="myDefault")
+ public abstract String getDefaultValue();
@InjectPage("SomePageName")
public abstract IPage getMyPage();
1.1
jakarta-tapestry/annotations/src/test/org/apache/tapestry/annotations/TestAnnotationLocation.java
Index: TestAnnotationLocation.java
===================================================================
// Copyright 2005 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.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package org.apache.tapestry.annotations;
import org.apache.hivemind.Resource;
import org.apache.hivemind.test.HiveMindTestCase;
/**
* Tests for [EMAIL PROTECTED]
org.apache.tapestry.annotations.AnnotationLocation}.
*
* @author Howard Lewis Ship
* @since 4.0
*/
public class TestAnnotationLocation extends HiveMindTestCase
{
public void testLineRowAreZero()
{
Resource r = (Resource) newMock(Resource.class);
replayControls();
AnnotationLocation l = new AnnotationLocation(r, "location
description");
assertEquals(0, l.getLineNumber());
assertEquals(0, l.getColumnNumber());
assertSame(r, l.getResource());
assertEquals("location description", l.toString());
verifyControls();
}
public void testEquals()
{
Resource r = (Resource) newMock(Resource.class);
Resource r2 = (Resource) newMock(Resource.class);
replayControls();
AnnotationLocation l = new AnnotationLocation(r, "location
description");
AnnotationLocation l2 = new AnnotationLocation(r2, "location
description");
AnnotationLocation l3 = new AnnotationLocation(r, "wrong
description");
AnnotationLocation l4 = new AnnotationLocation(r, "location
description");
assertEquals(false, l.equals(null));
assertEquals(false, l.equals("XYZ"));
assertEquals(false, l.equals(l2));
assertEquals(false, l.equals(l3));
assertEquals(true, l.equals(l4));
verifyControls();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]