Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Jakarta-velocity Wiki" 
for change notification.

The following page has been changed by ShinobuKawaiYoshida:
http://wiki.apache.org/jakarta-velocity/TestingVelocity

The comment on the change is:
add imports

------------------------------------------------------------------------------
  
  Instead of testing the whole template, I came up with a way to test template 
snippets.  This was more or less used as learning tests.  There are three 
classes used: !VelocityTestTool, !AbstractVelocityTestCase and 
!AbstractVelocityMockStrutsTestCase.  Developers will subclass 
!AbstractVelocity*!TestCase and do the usuall JUnit assertion like this:
  {{{
+ import org.apache.velocity.app.Velocity;
+ import org.apache.velocity.app.VelocityEngine;
+ import org.apache.velocity.runtime.RuntimeConstants;
+ 
  public class EscapeToolTest extends AbstractVelocityTestCase
  {
      public void testStringJava() throws Exception
@@ -43, +47 @@

  Here is what each class looks like:
   * !VelocityTestTool.java
  {{{
+ import java.io.IOException;
+ import java.io.StringWriter;
+ 
+ import junit.framework.TestCase;
+ 
+ import org.apache.commons.logging.Log;
+ import org.apache.commons.logging.LogFactory;
+ import org.apache.velocity.VelocityContext;
+ import org.apache.velocity.app.VelocityEngine;
+ import org.apache.velocity.context.Context;
+ import org.apache.velocity.exception.MethodInvocationException;
+ import org.apache.velocity.exception.ParseErrorException;
+ import org.apache.velocity.exception.ResourceNotFoundException;
+ 
  public class VelocityTestTool
  {
  
@@ -176, +194 @@

  }}}
   * !AbstractVelocityMockStrutsTestCase.java
  {{{
+ import java.io.IOException;
+ import java.io.StringWriter;
+ 
+ import org.apache.commons.logging.Log;
+ import org.apache.commons.logging.LogFactory;
+ import org.apache.velocity.VelocityContext;
+ import org.apache.velocity.app.VelocityEngine;
+ import org.apache.velocity.context.Context;
+ import org.apache.velocity.exception.MethodInvocationException;
+ import org.apache.velocity.exception.ParseErrorException;
+ import org.apache.velocity.exception.ResourceNotFoundException;
+ import org.apache.velocity.tools.view.context.ChainedContext;
+ 
+ import servletunit.struts.MockStrutsTestCase;
+ 
  public abstract class AbstractVelocityMockStrutsTestCase extends 
MockStrutsTestCase
  {
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to