@@ -0,0 +1,2010 @@
+/*%0A * Copyright 2002-2006 The Apache Software Foundation.%0A * %0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A * %0A *      http://www.apache.org/licenses/LICENSE-2.0%0A * %0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage org.apache.commons.jexl;%0A%0Aimport junit.framework.TestCase;%0A%0Apublic class WhileTest extends TestCase %7B%0A%0A    public WhileTest(String testName) %7B%0A        super(testName);%0A    %7D%0A%0A    public void testSimpleWhileFalse() throws Exception %7B%0A        Expression e = ExpressionFactory.createExpression(%22while (false) ;%22);%0A        JexlContext jc = JexlHelper.createContext();%0A%0A        Object o = e.evaluate(jc);%0A        assertNull(%22Result is not null%22, o);%0A    %7D%0A    %0A    public void testWhileExecutesExpressionWhenLooping() throws Exception %7B%0A        Expression e = ExpressionFactory.createExpression(%22while (x %3C 10) x = x + 1;%22);%0A        JexlContext jc = JexlHelper.createContext();%0A        jc.getVars().put(%22x%22, new Integer(1));%0A%0A        Object o = e.evaluate(jc);%0A        assertEquals(%22Result is wrong%22, new Long(10), o);%0A    %7D%0A%0A    public void testWhileWithBlock() throws Exception %7B%0A        Expression e = ExpressionFactory.createExpression(%22while (x %3C 10) %7B x = x + 1; y = y * 2; %7D%22);%0A        JexlContext jc = JexlHelper.createContext();%0A        jc.getVars().put(%22x%22, new Integer(1));%0A        jc.getVars().put(%22y%22, new Integer(1));%0A%0A        Object o = e.evaluate(jc);%0A        assertEquals(%22Result is wrong%22, new Long(512), o);%0A        assertEquals(%22x is wrong%22, new Long(10), jc.getVars().get(%22x%22));%0A        assertEquals(%22y is wrong%22, new Long(512), jc.getVars().get(%22y%22));%0A    %7D%0A%7D%0A

Implement while statement