Generates a test case as a string.
175158
def generate_content(self):
        """"""
        # Setup pre-conditions.
        if not self.variance:
            logging.error("%s: No variance information %s", self.id(), self.variance)
            sys.exit(-1)

        for var in self.variable.values():
            var.clear()

        # Handle variances
        variances = []
        for _ in range(random.randint(DharmaConst.VARIANCE_MIN, DharmaConst.VARIANCE_MAX)):
            var = random.choice(list(self.variance.values()))
            variances.append(DharmaConst.VARIANCE_TEMPLATE % var.generate(GenState()))
            variances.append("\n")

        # Handle variables
        variables = []
        for var in self.variable.values():
            if var.default:
                variables.append(DharmaConst.VARIANCE_TEMPLATE % var.default)
                variables.append("\n")

        # Build content
        content = "".join(chain([self.prefix], variables, variances, [self.suffix]))
        if self.template:
            return Template(self.template).safe_substitute(testcase_content=content)
        return content
409465
function _toCamelCase(str) {
  var newString = '';
  var insideParens = false;
  newString += str[0].toLowerCase();
  for (var i = 1; i < str.length; i++) {
    var char = str[i];
    switch (char) {
      case ')':
      case '_':
        break;
      case '(':
        insideParens = true;
        break;
      default:
        if (insideParens) {
          insideParens = false;
          newString += char.toUpperCase();
        } else {
          newString += char;
        }
        break;
    }
  }

  return newString;
}
959491
private StringGrabber replaceCaseTo(int startPos, int endPos, ECase toCase) {

		StringBuilder sbRange = new StringBuilder();

		try {
			for (int i = startPos; i < endPos; i++) {
				sbRange.append(String.valueOf(sb.charAt(i)));
			}
		} catch (Exception e) {
			e.printStackTrace();
		}

		final String caseConvertedRangeStr;

		if (ECase.LOWER == toCase) {
			caseConvertedRangeStr = sbRange.toString().toLowerCase();
		} else {
			caseConvertedRangeStr = sbRange.toString().toUpperCase();
		}
		try {
			sb.replace(startPos, endPos, caseConvertedRangeStr);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return StringGrabber.this;
	}
1339748
@Override
	public String getString(String fldName) throws RemoteException {
		try {
			fldName = fldName.toLowerCase(); // to ensure case-insensitivity
			return (String) s.getVal(fldName).castTo(VARCHAR).asJavaVal();
		} catch (RuntimeException e) {
			rconn.rollback();
			throw e;
		}
	}
988555
def to_lower_case(string)
      assert_type string, :String, :string
      Sass::Script::Value::String.new(Sass::Util.downcase(string.value), string.type)
    end
1091575
def _randomString():
    """"""

    return ''.join(
        random.choice(string.ascii_uppercase + string.digits)
        for x in range(10))
330151
def _to_camel_case(string):
        
        components = string.split('_')
        return '%s%s' % (
            components[0],
            ''.join(c.title() for c in components[1:]),
        )
603834
def _to_string(self):
        """"""
        if self.sections:
            start = "/" if self.bound_start else "**/"
            sections = "/**/".join(str(section) for section in self.sections)
            end = "" if self.bound_end else "/**"
        else:
            start = ""
            sections = ""
            end = "" if self.bound_end else "**"
        return "{0}{1}{2}/{3}".format(start, sections, end, str(self.file_pattern))
326570
function renderAttributeString(values, context) {
  if (typeof values === 'string' || typeof values === 'boolean') {
    return values;
  }

  var buffer = '';
  var toString = new ToString();
  for (var i = 0; i < values.length; i++) {
    toString.clear();
    render(toString, values[i], context);
    buffer += toString.getOutput();
  }

  return buffer;
}
141619
def dump_junit(self):
        """"""
        testsuites = ElementTree.Element('testsuites', name='therapist', time=str(round(self.execution_time, 2)),
                                         tests=str(self.count()), failures=str(self.count(status=Result.FAILURE)),
                                         errors=str(self.count(status=Result.ERROR)))

        for result in self.objects:
            failures = '1' if result.is_failure else '0'
            errors = '1' if result.is_error else '0'

            testsuite = ElementTree.SubElement(testsuites, 'testsuite', id=result.process.name,
                                               name=str(result.process), time=str(round(result.execution_time, 2)),
                                               tests='1', failures=failures, errors=errors)

            testcase = ElementTree.SubElement(testsuite, 'testcase', time=str(round(result.execution_time, 2)))
            testcase.attrib['name'] = result.process.name

            if result.is_failure or result.is_error:
                if result.is_failure:
                    element = ElementTree.SubElement(testcase, 'failure', type='failure')
                else:
                    element = ElementTree.SubElement(testcase, 'error', type='error')

                if result.error:
                    element.text = result.error
                else:
                    element.text = result.output if result.output else ''

        xmlstr = ElementTree.tostring(testsuites, encoding='utf-8').decode('utf-8')
        return '<?xml version="1.0" encoding="UTF-8"?>\n{}'.format(xmlstr)
883840
def name(value):
    
    if value is None:
        return 'any'
    for (test, name) in TESTS:
        if isinstance(value, test):
            return name
    return 'string'
54995
def snakecase(string)
      string.to_s.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
            .gsub(/([a-z\d])([A-Z])/, '\1_\2')
            .tr("-", "_")
            .gsub(/\s/, "_")
            .gsub(/__+/, "_")
            .downcase
    end
557331
public static String upcase(final String aString) {
        return aString.substring(0, 1).toUpperCase(Locale.getDefault()) + aString.substring(1);
    }
907946
static function extension($in,$case=false) {

		$name=self::filename($in);

		if (preg_match('~\.(\w{1,10})\s*$~',$name,$parts)) {
			if (!$case) return $parts[1];
			if (strtoupper($case)==self::LOWERCASE) return Strings::lower($parts[1]);
			if (strtoupper($case)==self::UPPERCASE) return Strings::upper($parts[1]);
			return $parts[1];
		}
		return "";
	}
174064
def to_upper_case(string)
      assert_type string, :String, :string
      Sass::Script::Value::String.new(Sass::Util.upcase(string.value), string.type)
    end
69602
private List<TestCaseDef> getBaseValidCases( FunctionInputDef inputDef, VarTupleSet validTuples, List<TestCaseDef> baseCases)
    {
    logger_.debug( "{}: Extending valid base test cases", inputDef);

    Iterator<TestCaseDef> validBaseCases =
      IteratorUtils.filteredIterator(
        baseCases.iterator(),
        testCase -> testCase.getInvalidVar() == null);

    List<TestCaseDef> testCases = extendBaseCases( inputDef, validTuples, validBaseCases);

    logger_.info( "{}: Extended {} valid base test cases", inputDef, testCases.size());
    return testCases;
   }
1279082
private void generateTCBasedData(List<TestCaseResult> allTestsList) {
        logger.entering(allTestsList);
        SummarizedData tempClass;
        SummarizedData tempGroupClass;
        Map<String, SummarizedData> mpClassData = new HashMap<String, SummarizedData>();
        int outputSheetRowCounter = 3;

        for (TestCaseResult tcResult : allTestsList) {

            // Segregating for class data
            String sTempClassName = tcResult.getClassName();

            // If class not already added to Class data, then create new ClassObject exists
            if (!mpClassData.containsKey(sTempClassName)) {
                tempClass = new SummarizedData();
                tempClass.setsName(sTempClassName);

            } else {
                tempClass = mpClassData.get(sTempClassName);
            }

            // Adding test to total count
            tempClass.incrementiTotal();

            // Adding all groups to map
            for (String sGroup : tcResult.getGroup()) {

                // Forming a key for the GroupClass map which is <GroupName><ClassName>
                String sGroupClassName = sGroup + sTempClassName;
                if (!mpGroupClassData.containsKey(sGroupClassName)) {
                    tempGroupClass = new SummarizedData();
                    tempGroupClass.setsName(sTempClassName);
                } else {
                    tempGroupClass = mpGroupClassData.get(sGroupClassName);
                }

                tempGroupClass.incrementiTotal();
                tempGroupClass.incrementCount(tcResult.getStatus());
                tempGroupClass.incrementDuration(tcResult.getDurationTaken());
                mpGroupClassData.put(sGroupClassName, tempGroupClass);
            }

            // Segregating for detailed Testcase Status wise data
            List<String> str = new ArrayList<String>();
            str.add(tcResult.getClassName());
            str.add(tcResult.getMethodName());
            str.add(tcResult.getTestDesc());
            str.add(tcResult.getGroup().toString());
            str.add(String.valueOf(tcResult.getDurationTaken()));
            str.add("'" + ReportSheetNames.TESTOUTPUTDETAILSREPORT.getName() + "'!B"
                    + Integer.toString(outputSheetRowCounter));

            List<String> outputStr = new ArrayList<String>();
            outputStr.add("Class Name:" + tcResult.getClassName());
            outputStr.add("Method/Testcase id:" + tcResult.getMethodName());
            outputStr.addAll(tcResult.getssmsg());

            // Based on status, incrementing class count and adding str to correct
            // list for TC detailed report
            switch (tcResult.getStatus()) {
                case ITestResult.FAILURE: {
                    tcFailedData.add(str);
                    // For failed cases adding data for defect description sheet
                    for (int iErrorCount = 0; iErrorCount < tcResult.getError().size(); iErrorCount++) {
                        List<String> tmpList = new ArrayList<String>();
                        tmpList.addAll(0, str);
                        tmpList.add(tcResult.getDefect().get(iErrorCount));
                        tmpList.add(tcResult.getError().get(iErrorCount));
                        outputStr.add("Stacktrace:" + tcResult.getError().get(iErrorCount));
                        tcDefectData.add(tmpList);
                    }
                    break;
                }
                case ITestResult.SUCCESS: {
                    tcPassedData.add(str);
                    break;
                }
                case ITestResult.SKIP: {
                    tcSkippedData.add(str);
                    break;
                }
                default: {
                    break;
                }
            }
            tcOutputData.add(outputStr);
            outputSheetRowCounter = outputSheetRowCounter + 1 + outputStr.size();

            tempClass.incrementCount(tcResult.getStatus());
            // Add to the total runtime of the class
            tempClass.setlRuntime(tempClass.getlRuntime() + tcResult.getDurationTaken());
            mpClassData.put(sTempClassName, tempClass);
        }
        lClasses.addAll(mpClassData.values());
        Collections.sort(lClasses);
        logger.exiting();
    }