public void testMutlipleOutObjects() throws Exception { fContext.setConfigProperty("createTwoObjects", true); ExecutionDiagnostic diagnostic = fExecutor.execute(fContext, fInput, fOutput); assertEquals(Diagnostic.OK, diagnostic.getSeverity()); assertOutputObject(fOutput); assertEquals(2, fOutput.getContents().size()); }
public void testAssertFailed() throws Exception { fContext.setConfigProperty("assertFail", Boolean.TRUE); // $NON-NLS-1$ ExecutionDiagnostic diagnostic = fExecutor.execute(fContext, fInput, fOutput); assertEquals(Diagnostic.ERROR, diagnostic.getSeverity()); assertEquals(ExecutionDiagnostic.FATAL_ASSERTION, diagnostic.getCode()); assertFalse(diagnostic.getStackTrace().isEmpty()); assertTrue(fOutput.getContents().isEmpty()); }
public void testStackTrace() throws Exception { // provoke an exception fContext.setConfigProperty("assertFail", Boolean.TRUE); // $NON-NLS-1$ ExecutionDiagnostic diagnostic = fExecutor.execute(fContext, fInput, fOutput); assertEquals(2, diagnostic.getStackTrace().size()); StringWriter strWr = new StringWriter(); diagnostic.printStackTrace(new PrintWriter(strWr)); strWr.flush(); StringWriter expected = new StringWriter(); PrintWriter pwr = new PrintWriter(expected); pwr.println(" at Ecore2Ecore::checkAssert(Ecore2Ecore.qvto:27)"); // $NON-NLS-1$ pwr.print(" at Ecore2Ecore::main(Ecore2Ecore.qvto:12)"); // $NON-NLS-1$ pwr.flush(); assertEquals(expected.toString(), strWr.toString()); }