Interface TestBuilder

All Known Implementing Classes:
TestBuilderImpl

public interface TestBuilder
High level builder for composing test class implementation fragments. Date: 22/04/2017
Author:
Yaron Yamin
  • Field Details

  • Method Details

    • renderMethodParams

      String renderMethodParams(Method method, Map<String,String> replacementTypes, Map<String,String> defaultTypeValues) throws Exception
      construct a formatted string of values passed to method invocation
      Parameters:
      method - method being called
      replacementTypes - type - value map where key is the fully qualified type name to be replaced with a template of initialized type, for arguments in method call. typically to replace interface type with concrete type initialization
      defaultTypeValues - default types - value map to be used for relevant type arguments in method call
      Returns:
      formatted string of method values
      Throws:
      Exception
    • buildPrameterizedTestComponents

      ParameterizedTestComponents buildPrameterizedTestComponents(Method method, Map<String,String> replacementTypesForReturn, Map<String,String> replacementTypes, Map<String,String> defaultTypeValues) throws Exception
      build constructs for composing a parameterized test call
      Parameters:
      method - mehtod being tested
      replacementTypesForReturn - possible replacement types for method returned type. typically to verify a returned interface type with concrete value
      replacementTypes - possible replacement types for method call values
      defaultTypeValues - default values to pass as method call parameters
      Returns:
      string constructs for composing a parameterized test call
      Throws:
      Exception
    • renderReturnParam

      String renderReturnParam(Method testedMethod, Type type, String defaultName, Map<String,String> replacementTypes, Map<String,String> defaultTypeValues) throws Exception
      builds a string representing the expression returning a resulted value to be verified or mocked
      Parameters:
      testedMethod - method being called
      type - return type
      defaultName - default string value to be used if type is a string or couldn't be resolved. should typically be a meaningful name
      replacementTypes - type - value map where key is the fully qualified type name to be replaced with a template of initialized type, for arguments in method call. typically to replace interface type with concrete type initialization
      defaultTypeValues - default types - value map to be used for relevant type arguments in method call
      Returns:
      a string representing the expression returning a resulted value to be verified
      Throws:
      Exception
    • renderInitType

      String renderInitType(Type type, String defaultName, Map<String,String> replacementTypes, Map<String,String> defaultTypeValues) throws Exception
      constructs a type initialization expression
      Parameters:
      type - type being initialized
      defaultName - efault string value to be used if type is a string or couldn't be resolved. should typically be a meaningful name
      replacementTypes - type - value map where key is the fully qualified type name to be replaced with a template of initialized type, for arguments in method call. typically to replace interface type with concrete type initialization
      defaultTypeValues - default types - value map to be used for relevant type arguments in method call
      Returns:
      type initialization expression
      Throws:
      Exception