org.easetech.easytest.loader
Class DataConverter

java.lang.Object
  extended by org.easetech.easytest.loader.DataConverter

public final class DataConverter
extends Object

A Utility class that helps DataDrivenTestRunner and DataContext classes to store the input test data in a format that is easy to display to the user as well as easy to interpret.

Author:
Anuj Kumar

Method Summary
static Map<String,List<Map<String,Object>>> appendClassName(Map<String,List<Map<String,Object>>> from, Class<?> currentTestClass)
          Prepend the className to the name of the method
static Map<String,List<Map<String,Object>>> convert(Map<String,List<Map<String,Object>>> from, Class<?> currentTestClass)
          Converts/normalize the input test data such that the name of the method is: prepended with the name of the Class that the method is associated with, and appended with the input test data that the method will take.
static String getFullyQualifiedTestName(String testMethod, Class testClass)
          Returns the fully qualified name of the test method such that: if the input testClass is null, return the test method name, else prepend the test method name with the name of the class and return.
static String getTruncatedMethodName(String testMethod, Class testClass)
          Get truncated method name such that: if the testMethod name starts with the testClass name, remove the name of the class and return the result, else return the test method
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

convert

public static Map<String,List<Map<String,Object>>> convert(Map<String,List<Map<String,Object>>> from,
                                                           Class<?> currentTestClass)
Converts/normalize the input test data such that the name of the method is:
  • prepended with the name of the Class that the method is associated with, and
  • appended with the input test data that the method will take.

    Parameters:
    from - the original input test data
    currentTestClass - the class of the methods that this input test data belongs to
    Returns:
    a Normalized input test data.

  • getFullyQualifiedTestName

    public static String getFullyQualifiedTestName(String testMethod,
                                                   Class testClass)
    Returns the fully qualified name of the test method such that:
  • if the input testClass is null, return the test method name, else
  • prepend the test method name with the name of the class and return.

    Parameters:
    testMethod - the name of the test method. Cannot be null
    testClass - the name of the test class, can be null.
    Returns:
    Fully qualified test method name

  • getTruncatedMethodName

    public static String getTruncatedMethodName(String testMethod,
                                                Class testClass)
    Get truncated method name such that:
  • if the testMethod name starts with the testClass name, remove the name of the class and return the result, else
  • return the test method

    Parameters:
    testMethod - the name of the test method. Cannot be null
    testClass - the name of the test class, can be null.
    Returns:
    the truncated method name

  • appendClassName

    public static Map<String,List<Map<String,Object>>> appendClassName(Map<String,List<Map<String,Object>>> from,
                                                                       Class<?> currentTestClass)
    Prepend the className to the name of the method

    Parameters:
    from - the input test data
    currentTestClass - the currently executing test class
    Returns:
    the converted test data


    Copyright © 2013. All Rights Reserved.