CVS: Tapestry/junit/src/net/sf/tapestry/junit/spec TestApplicationSpecification.java,1.6.2.1,1.6.2.2

Howard Lewis Ship <[email protected]>
Newsgroups gmane.comp.java.tapestry.cvs
Message-ID <[email protected]>
Update of /cvsroot/tapestry/Tapestry/junit/src/net/sf/tapestry/junit/spec
In directory sc8-pr-cvs1:/tmp/cvs-serv32418/junit/src/net/sf/tapestry/junit/spec

Modified Files:
      Tag: hship-2-3
	TestApplicationSpecification.java 
Log Message:
Require a IMonitor instance for each request.
Provide a shared null IMonitor implementation.
Allow a monitor to be specified as an application extension.
Add ability to check type of extension.

Index: TestApplicationSpecification.java
===================================================================
RCS file: /cvsroot/tapestry/Tapestry/junit/src/net/sf/tapestry/junit/spec/TestApplicationSpecification.java,v
retrieving revision 1.6.2.1
retrieving revision 1.6.2.2
diff -C2 -d -r1.6.2.1 -r1.6.2.2
*** TestApplicationSpecification.java	4 Dec 2002 03:31:57 -0000	1.6.2.1
--- TestApplicationSpecification.java	16 Dec 2002 12:56:36 -0000	1.6.2.2
***************
*** 1,4 ****
--- 1,5 ----
  package net.sf.tapestry.junit.spec;
  
+ import net.sf.tapestry.IMonitor;
  import net.sf.tapestry.junit.TapestryTestCase;
  import net.sf.tapestry.spec.ApplicationSpecification;
***************
*** 24,28 ****
      }
  
- 
      public void testBasicExtension() throws Exception
      {
--- 25,28 ----
***************
*** 37,56 ****
          assertEquals("stringProperty", "Tapestry: Java Web Components", extension.getStringProperty());
      }
!     
      public void testExtensionProperty() throws Exception
      {
          IApplicationSpecification a = parseApp("ExtensionProperty.application");
!         
          ExtensionSpecification e = a.getExtensionSpecification("testBean");
!         
          assertEquals("Property fred.", "flintstone", e.getProperty("fred"));
      }
!     
      public void testImmediateExtension() throws Exception
      {
          assertEquals("instanceCount", 0, ImmediateExtension.getInstanceCount());
!         
          parseApp("ImmediateExtension.application");
!         
          assertEquals("instanceCount", 1, ImmediateExtension.getInstanceCount());
      }
--- 37,97 ----
          assertEquals("stringProperty", "Tapestry: Java Web Components", extension.getStringProperty());
      }
! 
!     public void testExtensionType() throws Exception
!     {
!         IApplicationSpecification spec = parseApp("BasicExtension.application");
! 
!         TestBean extension = (TestBean) spec.getExtension("testBean", Object.class);
! 
!         assertNotNull(extension);
!     }
! 
!     public void testExtensionTypeFailClass() throws Exception
!     {
!         IApplicationSpecification spec = parseApp("BasicExtension.application");
! 
!         try
!         {
!             spec.getExtension("testBean", Number.class);
!             unreachable();
!         }
!         catch (IllegalArgumentException ex)
!         {
!             checkException(ex, "does not inherit from class java.lang.Number");
!         }
! 
!     }
! 
!     public void testExtensionTypeFailInterface() throws Exception
!     {
!         IApplicationSpecification spec = parseApp("BasicExtension.application");
! 
!         try
!         {
!             spec.getExtension("testBean", IMonitor.class);
!             unreachable();
!         }
!         catch (IllegalArgumentException ex)
!         {
!             checkException(ex, "does not implement interface net.sf.tapestry.IMonitor");
!         }
! 
!     }
! 
      public void testExtensionProperty() throws Exception
      {
          IApplicationSpecification a = parseApp("ExtensionProperty.application");
! 
          ExtensionSpecification e = a.getExtensionSpecification("testBean");
! 
          assertEquals("Property fred.", "flintstone", e.getProperty("fred"));
      }
! 
      public void testImmediateExtension() throws Exception
      {
          assertEquals("instanceCount", 0, ImmediateExtension.getInstanceCount());
! 
          parseApp("ImmediateExtension.application");
! 
          assertEquals("instanceCount", 1, ImmediateExtension.getInstanceCount());
      }



-------------------------------------------------------
This sf.net email is sponsored by:
With Great Power, Comes Great Responsibility 
Learn to use your power at OSDN's High Performance Computing Channel
http://hpc.devchannel.org/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.