Class TestBuilderImpl

  • All Implemented Interfaces:
    TestBuilder

    public class TestBuilderImpl
    extends java.lang.Object
    implements TestBuilder
    Date: 22/04/2017
    Author:
    Yaron Yamin
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ParameterizedTestComponents buildPrameterizedTestComponents​(Method method, java.util.Map<java.lang.String,​java.lang.String> typesOverridesForReturn, java.util.Map<java.lang.String,​java.lang.String> typesOverrides, java.util.Map<java.lang.String,​java.lang.String> defaultTypeValues)
      build constructs for composing a parameterized test call
      java.lang.String renderInitType​(Type type, java.lang.String defaultName, java.util.Map<java.lang.String,​java.lang.String> typesOverrides, java.util.Map<java.lang.String,​java.lang.String> defaultTypeValues)
      constructs a type initialization expression
      java.lang.String renderMethodParams​(Method method, java.util.Map<java.lang.String,​java.lang.String> typesOverrides, java.util.Map<java.lang.String,​java.lang.String> defaultTypeValues)
      construct a formatted string of values passed to method invocation
      java.lang.String renderReturnParam​(Method testedMethod, Type type, java.lang.String defaultName, java.util.Map<java.lang.String,​java.lang.String> typesOverrides, java.util.Map<java.lang.String,​java.lang.String> defaultTypeValues)
      builds a string representing the expression returning a resulted value to be verified or mocked
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TestBuilderImpl

        public TestBuilderImpl​(Language language,
                               com.intellij.openapi.module.Module srcModule,
                               TypeDictionary typeDictionary,
                               FileTemplateConfig fileTemplateConfig,
                               com.intellij.util.lang.JavaVersion javaVersion)
    • Method Detail

      • renderMethodParams

        public java.lang.String renderMethodParams​(Method method,
                                                   java.util.Map<java.lang.String,​java.lang.String> typesOverrides,
                                                   java.util.Map<java.lang.String,​java.lang.String> defaultTypeValues)
                                            throws java.lang.Exception
        Description copied from interface: TestBuilder
        construct a formatted string of values passed to method invocation
        Specified by:
        renderMethodParams in interface TestBuilder
        Parameters:
        method - method being called
        typesOverrides - 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:
        java.lang.Exception
      • buildPrameterizedTestComponents

        public ParameterizedTestComponents buildPrameterizedTestComponents​(Method method,
                                                                           java.util.Map<java.lang.String,​java.lang.String> typesOverridesForReturn,
                                                                           java.util.Map<java.lang.String,​java.lang.String> typesOverrides,
                                                                           java.util.Map<java.lang.String,​java.lang.String> defaultTypeValues)
                                                                    throws java.lang.Exception
        Description copied from interface: TestBuilder
        build constructs for composing a parameterized test call
        Specified by:
        buildPrameterizedTestComponents in interface TestBuilder
        Parameters:
        method - mehtod being tested
        typesOverridesForReturn - possible replacement types for method returned type. typically to verify a returned interface type with concrete value
        typesOverrides - 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:
        java.lang.Exception
      • renderReturnParam

        public java.lang.String renderReturnParam​(Method testedMethod,
                                                  Type type,
                                                  java.lang.String defaultName,
                                                  java.util.Map<java.lang.String,​java.lang.String> typesOverrides,
                                                  java.util.Map<java.lang.String,​java.lang.String> defaultTypeValues)
                                           throws java.lang.Exception
        Description copied from interface: TestBuilder
        builds a string representing the expression returning a resulted value to be verified or mocked
        Specified by:
        renderReturnParam in interface TestBuilder
        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
        typesOverrides - 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:
        java.lang.Exception
      • renderInitType

        public java.lang.String renderInitType​(Type type,
                                               java.lang.String defaultName,
                                               java.util.Map<java.lang.String,​java.lang.String> typesOverrides,
                                               java.util.Map<java.lang.String,​java.lang.String> defaultTypeValues)
                                        throws java.lang.Exception
        Description copied from interface: TestBuilder
        constructs a type initialization expression
        Specified by:
        renderInitType in interface TestBuilder
        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
        typesOverrides - 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:
        java.lang.Exception