Hey there,
 
    I have a few things I'd like to add to Velocity,
 
    but having never done any code additions don't really have the time to do it all right now, i do have a unit test prewritten to test the things i want. and if someone wouldn't mind pairing with me for about an hour and a half, i'm sure we could get everything done and committed so others could have the benefits of the labor.
 
    so anyone game?
    if your in san diego, we can do it in person, otherwise vnc and skype works great.
 
    I'll attach the unit test.
 
 
    Llewellyn Falco
package com.spun.util.velocity.tests;

import junit.framework.Assert;
import junit.framework.TestCase;
import org.apache.velocity.context.Context;
import com.spun.util.velocity.ContextAware;
import com.spun.util.velocity.VelocityParser;

public class VelocityTest
  extends TestCase implements ContextAware 
{
  public void testUnknownField()
  {
   assertErrorThrown("$main.unknownField");
  }
  /***********************************************************************/
  public void testUnknownFieldThenMethod()
  {
   assertErrorThrown("$main.unknownField.someMethod()");
  }
  /***********************************************************************/
  
  private void assertErrorThrown(String string) 
  {
    String result = null; 
    try
    {
      result = VelocityParser.parseString(string, this);
     }
    catch (Throwable t)
    {
      return;
    }
    Assert.fail("parsing '" + string + "' did not fail but returned '" + result + "'");
    
  }
  /***********************************************************************/
  public void testUnknownMethod() 
  {
    assertErrorThrown("$main.unknownMethod()");
  }
  /***********************************************************************/
  public void testNullPointer() 
  {
    assertErrorThrown("$main.getNull().callMethod()");
  }
  /***********************************************************************/
  public void testCodeWorks()  throws Exception
  {
    assertEquals(getClass().getName(), VelocityParser.parseString("$main.getClass().getName()", this));
  }
  /***********************************************************************/
 
  public Object getNull()
  {
    return null;
  }
  /***********************************************************************/
  public void setupContext(Context context)
  {
    context.put("main", this);
    
  }
	
}
/***********************************************************************/
/***********************************************************************/

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

Reply via email to