/* * FormulaFunction_UCaseTest.java * JUnit based test * * Created on August 9, 2006, 9:50 AM */ package com.accountingenhancements.formula; import com.accountingenhancements.common.SupportParameters; import junit.framework.*; import java.text.ParseException; import java.util.HashMap; /** * * @author lofgren */ public class FormulaFunction_UCaseTest extends TestCase { public FormulaFunction_UCaseTest(String testName) { super(testName); } protected void setUp() throws Exception { } protected void tearDown() throws Exception { } public static Test suite() { TestSuite suite = new TestSuite(FormulaFunction_UCaseTest.class); return suite; } /** * Test of solve method, of class com.accountingenhancements.formula.FormulaFunction_UCase. */ public void testFunction() throws Exception { System.out.println("function"); FormulaVariableList variableList = null; int iteration = 0; SupportParameters supportParameters = null; FormulaFunctionList functionList = null; int resolveEverythingAboveLevel = 0; FormulaFunction instance = new FormulaFunction_UCase(new FormulaVariable("","UCase(\"Hi There\")",0,true)); String expResult = "HI THERE"; FormulaVariable result = instance.function(variableList, iteration, supportParameters, functionList, resolveEverythingAboveLevel); assertEquals(expResult, result.getString()); } /** * Test of getName method, of class com.accountingenhancements.formula.FormulaFunction_UCase. */ public void testGetName()throws Exception { System.out.println("getName"); Class thisClass = Class.forName("com.accountingenhancements.formula.FormulaFunction_UCase"); String expResult = "UCase"; String result = (String)thisClass.getMethod("getName").invoke(thisClass); assertTrue("Was: <"+result+"> Expected: <"+expResult+">",expResult.equals(result)); } /** * Test of getRequiredSupportParameters method, of class com.accountingenhancements.formula.FormulaFunction_UCase. */ public void testGetRequiredSupportParameters()throws Exception { System.out.println("getRequiredSupportParameters"); String[][] result = FormulaFunction_UCase.getRequiredSupportParameters(); assertEquals(0, result.length); } /** * Test of getRequiredFormulaVariables method, of class com.accountingenhancements.formula.FormulaFunction_UCase. */ public void testGetRequiredFormulaVariables()throws Exception { System.out.println("getRequiredFormulaVariables"); String[][] result = FormulaFunction_UCase.getRequiredFormulaVariables(); assertEquals(0, result.length); } /** * Test of getRequiredArguments method, of class com.accountingenhancements.formula.FormulaFunction_UCase. */ public void testGetRequiredArguments()throws Exception { System.out.println("getRequiredArguments"); String expResult = null; String[][] result = FormulaFunction_UCase.getRequiredArguments(); assertEquals(1,result.length); assertEquals(2,result[0].length); expResult="ARG1: the source String that is to be converted to upper case"; assertEquals(expResult,result[0][0]); expResult="TYPE_STRING"; assertEquals(expResult,result[0][1]); } /** * Test of getReturnValueDescription method, of class com.accountingenhancements.formula.FormulaFunction_IIF. */ public void testGetReturnValueDescription()throws Exception { System.out.println("getReturnValueDescription"); String[] returnValueDescription = {"Upper case value of string in ARG1","TYPE_STRING"}; assertEquals(returnValueDescription[0],FormulaFunction_UCase.getReturnValueDescription()[0]); assertEquals(returnValueDescription[1],FormulaFunction_UCase.getReturnValueDescription()[1]); } }