AML14 / tratto

2 stars 1 forks source link

[experiment toga] Generate toga input file for tests where the last statement is a constructor #75

Open darthdaver opened 1 year ago

darthdaver commented 1 year ago

Example:

@Test(timeout = 4000) public void test01() throws Throwable { BorderArrangement borderArrangement0 = new BorderArrangement(); BlockContainer blockContainer0 = new BlockContainer(); FileSystemHandling.appendDataToFile((EvoSuiteFile) null, (byte[]) null); DynamicTimeSeriesCollection dynamicTimeSeriesCollection0 = new DynamicTimeSeriesCollection(0, 0); Range range0 = dynamicTimeSeriesCollection0.getRangeBounds(true); Range.shift(range0, (double) 0); blockContainer0.setPadding(2217.53419, (-1815.263695573213), 0.0, (double) 0); dynamicTimeSeriesCollection0.getRangeBounds(false); blockContainer0.clear(); borderArrangement0.add(blockContainer0, (Object) null); borderArrangement0.arrangeRR(blockContainer0, range0, range0, (Graphics2D) null); borderArrangement0.equals(range0); MockFileInputStream mockFileInputStream0 = null; try { mockFileInputStream0 = new MockFileInputStream(""); fail("Expecting exception: FileNotFoundException");

  } catch(Throwable e) {
     //
     // no message in exception (getMessage() returned null)
     //
     verifyException("org.evosuite.runtime.mock.java.io.MockFileInputStream", e);
  }

In this case, the last statement is a constructor:

mockFileInputStream0 = new MockFileInputStream("");

with JavaParser and SymbolSolver is very difficult to get the corresponding ConstructorDeclaration from the analysis of the test