Class TestBuilderImpl
java.lang.Object
com.weirddev.testme.intellij.template.context.impl.TestBuilderImpl
- All Implemented Interfaces:
TestBuilder
Date: 22/04/2017
- Author:
- Yaron Yamin
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.weirddev.testme.intellij.template.context.TestBuilder
TestBuilder.ParamRole -
Field Summary
Fields inherited from interface com.weirddev.testme.intellij.template.context.TestBuilder
RESULT_VARIABLE_NAME -
Constructor Summary
ConstructorsConstructorDescriptionTestBuilderImpl(Language language, com.intellij.openapi.module.Module srcModule, TypeDictionary typeDictionary, FileTemplateConfig fileTemplateConfig, com.intellij.util.lang.JavaVersion javaVersion) -
Method Summary
Modifier and TypeMethodDescriptionbuildPrameterizedTestComponents(Method method, Map<String, String> typesOverridesForReturn, Map<String, String> typesOverrides, Map<String, String> defaultTypeValues) build constructs for composing a parameterized test callrenderInitType(Type type, String defaultName, Map<String, String> typesOverrides, Map<String, String> defaultTypeValues) constructs a type initialization expressionrenderMethodParams(Method method, Map<String, String> typesOverrides, Map<String, String> defaultTypeValues) construct a formatted string of values passed to method invocationrenderReturnParam(Method testedMethod, Type type, String defaultName, Map<String, String> typesOverrides, Map<String, String> defaultTypeValues) builds a string representing the expression returning a resulted value to be verified or mocked
-
Constructor Details
-
TestBuilderImpl
public TestBuilderImpl(Language language, com.intellij.openapi.module.Module srcModule, TypeDictionary typeDictionary, FileTemplateConfig fileTemplateConfig, com.intellij.util.lang.JavaVersion javaVersion)
-
-
Method Details
-
renderMethodParams
public String renderMethodParams(Method method, Map<String, String> typesOverrides, Map<String, throws ExceptionString> defaultTypeValues) Description copied from interface:TestBuilderconstruct a formatted string of values passed to method invocation- Specified by:
renderMethodParamsin interfaceTestBuilder- Parameters:
method- method being calledtypesOverrides- 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 initializationdefaultTypeValues- default types - value map to be used for relevant type arguments in method call- Returns:
- formatted string of method values
- Throws:
Exception
-
buildPrameterizedTestComponents
public ParameterizedTestComponents buildPrameterizedTestComponents(Method method, Map<String, String> typesOverridesForReturn, Map<String, throws ExceptionString> typesOverrides, Map<String, String> defaultTypeValues) Description copied from interface:TestBuilderbuild constructs for composing a parameterized test call- Specified by:
buildPrameterizedTestComponentsin interfaceTestBuilder- Parameters:
method- mehtod being testedtypesOverridesForReturn- possible replacement types for method returned type. typically to verify a returned interface type with concrete valuetypesOverrides- possible replacement types for method call valuesdefaultTypeValues- default values to pass as method call parameters- Returns:
- string constructs for composing a parameterized test call
- Throws:
Exception
-
renderReturnParam
public String renderReturnParam(Method testedMethod, Type type, String defaultName, Map<String, String> typesOverrides, Map<String, throws ExceptionString> defaultTypeValues) Description copied from interface:TestBuilderbuilds a string representing the expression returning a resulted value to be verified or mocked- Specified by:
renderReturnParamin interfaceTestBuilder- Parameters:
testedMethod- method being calledtype- return typedefaultName- default string value to be used if type is a string or couldn't be resolved. should typically be a meaningful nametypesOverrides- 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 initializationdefaultTypeValues- 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
public String renderInitType(Type type, String defaultName, Map<String, String> typesOverrides, Map<String, throws ExceptionString> defaultTypeValues) Description copied from interface:TestBuilderconstructs a type initialization expression- Specified by:
renderInitTypein interfaceTestBuilder- Parameters:
type- type being initializeddefaultName- efault string value to be used if type is a string or couldn't be resolved. should typically be a meaningful nametypesOverrides- 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 initializationdefaultTypeValues- default types - value map to be used for relevant type arguments in method call- Returns:
- type initialization expression
- Throws:
Exception
-