public VariableReference addFieldAssignment(TestCase test,GenericField field,int position,int recursionDepth) throws ConstructionFailedException {
  logger.debug("Recursion depth: " + recursionDepth);
  if (recursionDepth > Properties.MAX_RECURSION) {
    logger.debug("Max recursion depth reached");
    throw new ConstructionFailedException("Max recursion depth reached");
  }
  logger.debug("Adding field " + field);
  int length=test.size();
  VariableReference callee=null;
  if (!field.isStatic()) {
    callee=createOrReuseVariable(test,field.getOwnerType(),position,recursionDepth,null,false,false,false);
    position+=test.size() - length;
    length=test.size();
    if (!TestUsageChecker.canUse(field.getField(),callee.getVariableClass())) {
      logger.debug("Cannot call field " + field + " with callee of type "+ callee.getClassName());
      throw new ConstructionFailedException("Cannot apply field to this callee");
    }
  }
  VariableReference var=createOrReuseVariable(test,field.getFieldType(),position,recursionDepth,callee,true,false,false);
  int newLength=test.size();
  position+=(newLength - length);
  FieldReference f=new FieldReference(test,field,callee);
  if (f.equals(var))   throw new ConstructionFailedException("Self assignment");
  Statement st=new AssignmentStatement(test,f,var);
  VariableReference ret=test.addStatement(st,position);
  assert (test.isValid());
  return ret;
}

public VariableReference addFieldAssignment ( TestCase test , GenericField field , int position , int recursionDepth ) throws ConstructionFailedException { logger . debug ( "Recursion depth: " + recursionDepth ) ; if ( recursionDepth > Properties . MAX_RECURSION ) { logger . debug ( "Max recursion depth reached" ) ; throw new ConstructionFailedException ( "Max recursion depth reached" ) ; } logger . debug ( "Adding field " + field ) ; int length = test . size ( ) ; VariableReference callee = null ; if ( ! field . isStatic ( ) ) { callee = createOrReuseVariable ( test , field . getOwnerType ( ) , position , recursionDepth , null , false , false , false ) ; position += test . size ( ) - length ; length = test . size ( ) ; if ( ! TestUsageChecker . canUse ( field . getField ( ) , callee . getVariableClass ( ) ) ) { logger . debug ( "Cannot call field " + field + " with callee of type " + callee . getClassName ( ) ) ; throw new ConstructionFailedException ( "Cannot apply field to this callee" ) ; } } VariableReference var = createOrReuseVariable ( test , field . getFieldType ( ) , position , recursionDepth , callee , true , false , false ) ; int newLength = test . size ( ) ; position += ( newLength - length ) ; FieldReference f = new FieldReference ( test , field , callee ) ; if ( f . equals ( var ) ) throw new ConstructionFailedException ( "Self assignment" ) ; Statement st = new AssignmentStatement ( test , f , var ) ; VariableReference ret = test . addStatement ( st , position ) ; assert ( test . isValid ( ) ) ; return ret ; }
add method at given position if max recursion depth has not been reached
