Search in sources :

Example 1 with TestCaseWithURL

use of com.examples.with.different.packagename.concolic.TestCaseWithURL in project evosuite by EvoSuite.

the class ConcolicExecutionEnvironmentTest method buildTestCaseWithURL.

private static DefaultTestCase buildTestCaseWithURL() throws SecurityException, NoSuchMethodException {
    TestCaseBuilder tc = new TestCaseBuilder();
    // int int0 = 10;
    VariableReference int0 = tc.appendIntPrimitive(10);
    // String urlString = "http://evosuite.org/hello.txt";
    VariableReference urlStringVarRef = tc.appendStringPrimitive("http://evosuite.org/hello.txt");
    // MockURL mockURL0 = MockURL.URL(urlString);
    Method urlMethod = MockURL.class.getMethod("URL", String.class);
    VariableReference mockURLVarRef = tc.appendMethod(null, urlMethod, urlStringVarRef);
    // EvoSuiteURL evosuiteURL = new EvoSuiteURL();
    Constructor<EvoSuiteURL> evoSuiteURLCtor = EvoSuiteURL.class.getConstructor(String.class);
    VariableReference evosuiteURL = tc.appendConstructor(evoSuiteURLCtor, urlStringVarRef);
    // String string0 = "<<FILE CONTENT>>"
    VariableReference string0VarRef = tc.appendStringPrimitive("<<FILE CONTENT>>");
    // NetworkHandling.createRemoteTextFile(url, string0)
    Method appendStringToFileMethod = NetworkHandling.class.getMethod("createRemoteTextFile", EvoSuiteURL.class, String.class);
    tc.appendMethod(null, appendStringToFileMethod, evosuiteURL, string0VarRef);
    // TestCaseWithURL testCaseWithURL0 = new TestCaseWithURL();
    Constructor<TestCaseWithURL> ctor = TestCaseWithURL.class.getConstructor();
    VariableReference testCaseWithURLVarRef = tc.appendConstructor(ctor);
    // String ret_val = dseWithFile0.test((URL) mockURL0);
    Method testMethod = TestCaseWithURL.class.getMethod("test", URL.class);
    tc.appendMethod(testCaseWithURLVarRef, testMethod, mockURLVarRef);
    // DseWithFile.isiZero(int0)
    Method isZeroMethod = TestCaseWithFile.class.getMethod("isZero", int.class);
    tc.appendMethod(null, isZeroMethod, int0);
    return tc.getDefaultTestCase();
}
Also used : VariableReference(org.evosuite.testcase.variable.VariableReference) EvoSuiteURL(org.evosuite.runtime.testdata.EvoSuiteURL) Method(java.lang.reflect.Method) TestCaseWithURL(com.examples.with.different.packagename.concolic.TestCaseWithURL)

Aggregations

TestCaseWithURL (com.examples.with.different.packagename.concolic.TestCaseWithURL)1 Method (java.lang.reflect.Method)1 EvoSuiteURL (org.evosuite.runtime.testdata.EvoSuiteURL)1 VariableReference (org.evosuite.testcase.variable.VariableReference)1