use of com.examples.with.different.packagename.concolic.TestCaseWithFile in project evosuite by EvoSuite.
the class ConcolicExecutionEnvironmentTest method buildTestCaseWithFile.
private static DefaultTestCase buildTestCaseWithFile() throws SecurityException, NoSuchMethodException {
TestCaseBuilder tc = new TestCaseBuilder();
// int int0 = 10;
VariableReference int0 = tc.appendIntPrimitive(10);
// MockFile mockFile0 = (MockFile)MockFile.createTempFile("tmp",
// "foo.txt");
VariableReference prefixVarRef = tc.appendStringPrimitive("temp");
VariableReference sufixVarRef = tc.appendStringPrimitive(".txt");
Method createTempFileMethod = MockFile.class.getMethod("createTempFile", String.class, String.class);
VariableReference mockFileVarRef = tc.appendMethod(null, createTempFileMethod, prefixVarRef, sufixVarRef);
// String path = mockFile0.getPath;
Method getPathMethod = MockFile.class.getMethod("getPath");
VariableReference pathVarRef = tc.appendMethod(mockFileVarRef, getPathMethod);
// EvoSuiteFile evosuiteFile = new EvoSuiteFile();
Constructor<EvoSuiteFile> evoSuiteFileCtor = EvoSuiteFile.class.getConstructor(String.class);
VariableReference evosuiteFile = tc.appendConstructor(evoSuiteFileCtor, pathVarRef);
// String string0 = "<<FILE CONTENT>>"
VariableReference fileContentVarRef = tc.appendStringPrimitive("<<FILE CONTENT>>");
// FileSystemHandling.appendStringToFile(evosuiteFile, string0)
Method appendStringToFileMethod = FileSystemHandling.class.getMethod("appendStringToFile", EvoSuiteFile.class, String.class);
tc.appendMethod(null, appendStringToFileMethod, evosuiteFile, fileContentVarRef);
// DseWithFile dseWithFile0 = new DseWithFile();
Constructor<TestCaseWithFile> ctor = TestCaseWithFile.class.getConstructor();
VariableReference dseWithFileVarRef = tc.appendConstructor(ctor);
// String ret_val = dseWithFile0.test((File) mockFile0);
Method testMethod = TestCaseWithFile.class.getMethod("test", File.class);
tc.appendMethod(dseWithFileVarRef, testMethod, mockFileVarRef);
// DseWithFile.isiZero(int0)
Method isZeroMethod = TestCaseWithFile.class.getMethod("isZero", int.class);
tc.appendMethod(null, isZeroMethod, int0);
return tc.getDefaultTestCase();
}
Aggregations