org.apache.velocity.test
Class ForeachTestCase

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.velocity.test.ForeachTestCase
All Implemented Interfaces:
junit.framework.Test

public class ForeachTestCase
extends junit.framework.TestCase

This class tests the Foreach loop.

Author:
Daniel Rall, Will Glass-Husain

Nested Class Summary
static class ForeachTestCase.MyIterable
           
static class ForeachTestCase.NotReallyIterable
           
 
Constructor Summary
ForeachTestCase(String name)
           
 
Method Summary
 void setUp()
           
 void testCollectionAndMethodCall()
          Tests proper method execution during a Foreach loop over a Collection with items of varying classes.
 void testMaxNbrLoopsConstraint()
          Tests limiting of the number of loop iterations.
 void testNotReallyIterableIteratorMethod()
           
 void testObjectWithIteratorMethod()
          Tests that #foreach will be able to retrieve an iterator from an arbitrary object that happens to have an iterator() method.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ForeachTestCase

public ForeachTestCase(String name)
Method Detail

setUp

public void setUp()
           throws Exception
Overrides:
setUp in class junit.framework.TestCase
Throws:
Exception

testMaxNbrLoopsConstraint

public void testMaxNbrLoopsConstraint()
                               throws Exception
Tests limiting of the number of loop iterations.

Throws:
Exception

testCollectionAndMethodCall

public void testCollectionAndMethodCall()
                                 throws Exception
Tests proper method execution during a Foreach loop over a Collection with items of varying classes.

Throws:
Exception

testObjectWithIteratorMethod

public void testObjectWithIteratorMethod()
                                  throws Exception
Tests that #foreach will be able to retrieve an iterator from an arbitrary object that happens to have an iterator() method. (With the side effect of supporting the new Java 5 Iterable interface)

Throws:
Exception

testNotReallyIterableIteratorMethod

public void testNotReallyIterableIteratorMethod()
                                         throws Exception
Throws:
Exception


Copyright © 2000-2008 The Apache Software Foundation. All Rights Reserved.