Author: doogie
Date: Tue Feb 23 15:42:17 2010 New Revision: 915390 URL: http://svn.apache.org/viewvc?rev=915390&view=rev Log: Move FMA tests to a separate file. Added: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/test/FlexibleMapAccessorTests.java Modified: ofbiz/trunk/framework/base/build.xml ofbiz/trunk/framework/base/src/org/ofbiz/base/test/BaseUnitTests.java ofbiz/trunk/framework/base/testdef/basetests.xml Modified: ofbiz/trunk/framework/base/build.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/build.xml?rev=915390&r1=915389&r2=915390&view=diff ============================================================================== --- ofbiz/trunk/framework/base/build.xml (original) +++ ofbiz/trunk/framework/base/build.xml Tue Feb 23 15:42:17 2010 @@ -41,6 +41,7 @@ <file name="org/ofbiz/base/util/test/IndentingWriterTests.java"/> <file name="org/ofbiz/base/util/test/UtilObjectTests.java"/> <file name="org/ofbiz/base/util/string/test/FlexibleStringExpanderTests.java"/> + <file name="org/ofbiz/base/util/collections/test/FlexibleMapAccessorTests.java"/> <file name="org/ofbiz/base/util/test/TimeDurationTests.java"/> <file name="org/ofbiz/base/json/test/JSONTests.java"/> <file name="org/ofbiz/base/conversion/test/DateTimeTests.java"/> Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/test/BaseUnitTests.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/test/BaseUnitTests.java?rev=915390&r1=915389&r2=915390&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/test/BaseUnitTests.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/test/BaseUnitTests.java Tue Feb 23 15:42:17 2010 @@ -32,8 +32,6 @@ import org.ofbiz.base.util.StringUtil; import org.ofbiz.base.util.UtilFormatOut; import org.ofbiz.base.util.UtilValidate; -import org.ofbiz.base.util.collections.FlexibleMapAccessor; -import org.ofbiz.base.util.string.FlexibleStringExpander; public class BaseUnitTests extends TestCase { @@ -112,21 +110,6 @@ } } - // These tests rely upon FlexibleStringExpander, so they - // should follow the FlexibleStringExpander tests. - public void testFlexibleMapAccessor() { - String compare = "Hello World!"; - Map<String, Object> testMap = new HashMap<String, Object>(); - FlexibleMapAccessor<String> fma = FlexibleMapAccessor.getInstance("parameters.var"); - fma.put(testMap, "World"); - FlexibleStringExpander fse = FlexibleStringExpander.getInstance("Hello ${parameters.var}!"); - assertTrue("UEL auto-vivify Map", compare.equals(fse.expandString(testMap))); - fma = FlexibleMapAccessor.getInstance("parameters.someList[+0]"); - fma.put(testMap, "World"); - fse = FlexibleStringExpander.getInstance("Hello ${parameters.someList[0]}!"); - assertTrue("UEL auto-vivify List " + fse.expandString(testMap), compare.equals(fse.expandString(testMap))); - } - public void testStringUtil() { byte[] testArray = {-1}; byte[] result = StringUtil.fromHexString(StringUtil.toHexString(testArray)); Added: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/test/FlexibleMapAccessorTests.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/test/FlexibleMapAccessorTests.java?rev=915390&view=auto ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/test/FlexibleMapAccessorTests.java (added) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/test/FlexibleMapAccessorTests.java Tue Feb 23 15:42:17 2010 @@ -0,0 +1,51 @@ +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + *******************************************************************************/ +package org.ofbiz.base.util.collections.test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import junit.framework.TestCase; + +import org.ofbiz.base.util.collections.FlexibleMapAccessor; +import org.ofbiz.base.util.string.FlexibleStringExpander; + +public class FlexibleMapAccessorTests extends TestCase { + + public FlexibleMapAccessorTests(String name) { + super(name); + } + + // These tests rely upon FlexibleStringExpander, so they + // should follow the FlexibleStringExpander tests. + public void testFlexibleMapAccessor() { + String compare = "Hello World!"; + Map<String, Object> testMap = new HashMap<String, Object>(); + FlexibleMapAccessor<String> fma = FlexibleMapAccessor.getInstance("parameters.var"); + fma.put(testMap, "World"); + FlexibleStringExpander fse = FlexibleStringExpander.getInstance("Hello ${parameters.var}!"); + assertTrue("UEL auto-vivify Map", compare.equals(fse.expandString(testMap))); + fma = FlexibleMapAccessor.getInstance("parameters.someList[+0]"); + fma.put(testMap, "World"); + fse = FlexibleStringExpander.getInstance("Hello ${parameters.someList[0]}!"); + assertTrue("UEL auto-vivify List " + fse.expandString(testMap), compare.equals(fse.expandString(testMap))); + } +} Modified: ofbiz/trunk/framework/base/testdef/basetests.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/testdef/basetests.xml?rev=915390&r1=915389&r2=915390&view=diff ============================================================================== --- ofbiz/trunk/framework/base/testdef/basetests.xml (original) +++ ofbiz/trunk/framework/base/testdef/basetests.xml Tue Feb 23 15:42:17 2010 @@ -24,6 +24,7 @@ <junit-test-suite class-name="org.ofbiz.base.util.test.IndentingWriterTests"/> <junit-test-suite class-name="org.ofbiz.base.util.test.UtilObjectTests"/> <junit-test-suite class-name="org.ofbiz.base.util.string.test.FlexibleStringExpanderTests"/> + <junit-test-suite class-name="org.ofbiz.base.util.collections.test.FlexibleMapAccessorTests"/> <junit-test-suite class-name="org.ofbiz.base.util.test.TimeDurationTests"/> <junit-test-suite class-name="org.ofbiz.base.conversion.test.DateTimeTests.java"/> <junit-test-suite class-name="org.ofbiz.base.conversion.test.MiscTests.java"/> |
Free forum by Nabble | Edit this page |