template.TestArrayTemplate.vsl Maven / Gradle / Ivy
## Velocity Template.
package ${functionPackage};
#foreach( $import in $imports)
import $import;
#end
/**
* generated Test array wrapper.
*
* target class : ${targetClass}
* target method : ${targetMethod}
*
* @author Greg Higgins
*/
#if(${filter})
public class ${functionClass} implements Wrapper<${filterSubjectClass}>{
#else
public class ${functionClass} implements Test{
#end
//source operand inputs
public ${sourceClass}[] filterArray = new ${sourceClass}[${arraySize}];
//element under test
public ${sourceClass} ${arrayElement};
#foreach($sourceInfo in $sourceMappingList)
public ${sourceInfo.type} ${sourceInfo.id};
#end
private ${targetClass} f;
#if(${changetNotifier})
private boolean result;
@Initialise
public void init(){
f = new ${targetClass}();
result = false;
}
@OnParentUpdate("filterArray")
public void filterSourceUpdated(${sourceClass} parentChanged){
${arrayElement} = parentChanged;
}
@OnEvent
public boolean onEvent(){
boolean oldValue = result;
result = f.${targetMethod}(${input});
return (!oldValue) & result;
}
#else
@Initialise
public void init(){
f = new ${targetClass}();
}
@OnParentUpdate("filterArray")
public void filterSourceUpdated(${sourceClass} parentChanged){
${arrayElement} = parentChanged;
}
@OnEvent
public boolean onEvent(){
return f.${targetMethod}(${input});
}
#end
#if(${filter})
@Override
public ${filterSubjectClass} event() {
#if(${wrappedSubject})
return (${filterSubjectClass})filterElementToTest.event();
#else
return filterElementToTest;
#end
}
@Override
public Class<${filterSubjectClass}> eventClass() {
return ${filterSubjectClass}.class;
}
#end
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy