org.pentaho.di.trans.steps.scriptvalues_mod
Class JavaScriptStringTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.pentaho.di.trans.steps.scriptvalues_mod.JavaScriptStringTest
All Implemented Interfaces:
junit.framework.Test

public class JavaScriptStringTest
extends junit.framework.TestCase

Test class for the Modified Javascript step. Things tested: ltrim(), rtrim(), trim(), lpad(), rpad(), upper(), lower(), isNum(), str2num(), num2str(). Still to do: - Use multiple arguments in str2num/num2str (tests only with 1 argument) - Defined error handling

Author:
Sven Boden

Constructor Summary
JavaScriptStringTest()
           
 
Method Summary
 void checkRows(List<RowMetaAndData> rows1, List<RowMetaAndData> rows2)
          Check the 2 lists comparing the rows in order.
 List<RowMetaAndData> createData1()
           
 List<RowMetaAndData> createData2()
           
 List<RowMetaAndData> createData3()
           
 List<RowMetaAndData> createData4()
           
 List<RowMetaAndData> createResultData1()
          Create result data for test case 1.
 List<RowMetaAndData> createResultData2()
          Create result data for test case 2: lpad/rpad/upper/lower.
 List<RowMetaAndData> createResultData3()
          Create result data for test case 3: isNum, num2str, str2num.
 List<RowMetaAndData> createResultData4()
          Create result data for test case 4: indexOf.
 RowMetaInterface createRowMetaInterface1()
           
 RowMetaInterface createRowMetaInterface2()
           
 RowMetaInterface createRowMetaInterfaceResult1()
          Create the meta data for the results (ltrim/rtrim/trim).
 RowMetaInterface createRowMetaInterfaceResult2()
          Create the meta data for the results (lpad/rpad/upper/lower).
 RowMetaInterface createRowMetaInterfaceResult3()
          Create the meta data for the results (isnum/num2str/str2num).
 RowMetaInterface createRowMetaInterfaceResult4()
          Create the meta data for the results (indexOf).
 void testIndexOf()
          Test case for javascript functionality: indexOf().
 void testStringsNum()
           
 void testStringsPadCase()
          Test case for javascript functionality: lpad(), rpad(), upper(), lower().
 void testStringsTrim()
          Test case for javascript functionality: ltrim(), rtrim(), trim().
 
Methods inherited from class junit.framework.TestCase
countTestCases, getName, run, run, runBare, setName, 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, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JavaScriptStringTest

public JavaScriptStringTest()
Method Detail

createRowMetaInterface1

public RowMetaInterface createRowMetaInterface1()

createData1

public List<RowMetaAndData> createData1()

createData2

public List<RowMetaAndData> createData2()

createData3

public List<RowMetaAndData> createData3()

createRowMetaInterfaceResult1

public RowMetaInterface createRowMetaInterfaceResult1()
Create the meta data for the results (ltrim/rtrim/trim).


createResultData1

public List<RowMetaAndData> createResultData1()
Create result data for test case 1.


createRowMetaInterfaceResult2

public RowMetaInterface createRowMetaInterfaceResult2()
Create the meta data for the results (lpad/rpad/upper/lower).


createRowMetaInterfaceResult3

public RowMetaInterface createRowMetaInterfaceResult3()
Create the meta data for the results (isnum/num2str/str2num).


createResultData2

public List<RowMetaAndData> createResultData2()
Create result data for test case 2: lpad/rpad/upper/lower.


createResultData3

public List<RowMetaAndData> createResultData3()
Create result data for test case 3: isNum, num2str, str2num.


createRowMetaInterface2

public RowMetaInterface createRowMetaInterface2()

createData4

public List<RowMetaAndData> createData4()

createRowMetaInterfaceResult4

public RowMetaInterface createRowMetaInterfaceResult4()
Create the meta data for the results (indexOf).


createResultData4

public List<RowMetaAndData> createResultData4()
Create result data for test case 4: indexOf.


checkRows

public void checkRows(List<RowMetaAndData> rows1,
                      List<RowMetaAndData> rows2)
Check the 2 lists comparing the rows in order. If they are not the same fail the test.


testStringsTrim

public void testStringsTrim()
                     throws Exception
Test case for javascript functionality: ltrim(), rtrim(), trim().

Throws:
Exception

testStringsPadCase

public void testStringsPadCase()
                        throws Exception
Test case for javascript functionality: lpad(), rpad(), upper(), lower().

Throws:
Exception

testStringsNum

public void testStringsNum()
                    throws Exception
Throws:
Exception

testIndexOf

public void testIndexOf()
                 throws Exception
Test case for javascript functionality: indexOf().

Throws:
Exception