-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Spec] Stacktraces within table forEach are incomplete #58
Comments
Hm. I can't reproduce this. With your example I get the following exception:
and double clicking the first line brings me to the correct line in my spec. Is it possible that you original example is a little bit different? |
That's weird. I updated Jnario to 0.3.0.201211300028 and retested posted example again. I still get
Any ideas? Tested on Windows XP 32, Eclipse 3.8 (not 4.2). |
Could you please post the generated Java code. |
StacktracesShouldBeAlsoCorrectWithinTableForEachLambdasSpec.java: package de.finkonsens.pingo.testtools.xfactory.test;
import de.finkonsens.pingo.testtools.xfactory.test.StacktracesShouldBeAlsoCorrectWithinTableForEachLambdasSpecTable;
import org.eclipse.xtext.xbase.lib.Exceptions;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.jnario.lib.ExampleTable;
import org.jnario.lib.ExampleTableIterators;
import org.jnario.runner.ExampleGroupRunner;
import org.jnario.runner.Named;
import org.jnario.runner.Order;
import org.junit.Test;
import org.junit.runner.RunWith;
@SuppressWarnings("all")
@RunWith(ExampleGroupRunner.class)
@Named("Stacktraces should be also correct within table forEach lambdas")
public class StacktracesShouldBeAlsoCorrectWithinTableForEachLambdasSpec {
public ExampleTable<StacktracesShouldBeAlsoCorrectWithinTableForEachLambdasSpecTable> _initStacktracesShouldBeAlsoCorrectWithinTableForEachLambdasSpecTable() {
return ExampleTable.create("table",
java.util.Arrays.asList("a"),
new StacktracesShouldBeAlsoCorrectWithinTableForEachLambdasSpecTable( java.util.Arrays.asList("1"), 1)
);
}
protected ExampleTable<StacktracesShouldBeAlsoCorrectWithinTableForEachLambdasSpecTable> table = _initStacktracesShouldBeAlsoCorrectWithinTableForEachLambdasSpecTable();
@Test
@Named("throw exception in the table forEach")
@Order(1)
public void _throwExceptionInTheTableForEach() throws Exception {
final Procedure1<StacktracesShouldBeAlsoCorrectWithinTableForEachLambdasSpecTable> _function = new Procedure1<StacktracesShouldBeAlsoCorrectWithinTableForEachLambdasSpecTable>() {
public void apply(final StacktracesShouldBeAlsoCorrectWithinTableForEachLambdasSpecTable it) {
try {
Exception _exception = new Exception();
throw _exception;
} catch (Exception _e) {
throw Exceptions.sneakyThrow(_e);
}
}
};
ExampleTableIterators.<StacktracesShouldBeAlsoCorrectWithinTableForEachLambdasSpecTable>forEach(this.table, _function);
}
} and StacktracesShouldBeAlsoCorrectWithinTableForEachLambdasSpecTable.java: package de.finkonsens.pingo.testtools.xfactory.test;
import java.util.List;
import org.jnario.lib.ExampleTableRow;
public class StacktracesShouldBeAlsoCorrectWithinTableForEachLambdasSpecTable extends ExampleTableRow {
public StacktracesShouldBeAlsoCorrectWithinTableForEachLambdasSpecTable(final List<String> cellNames, final int a) {
super(cellNames);
this.a = a;
}
public int a;
public int getA() {
return a;
}
public List<String> getCells() {
return java.util.Arrays.asList(toString(a));
}
} |
Hm. The generated Java code is identical. This is the exception I get from your generated java classes:
Sorry - I can't reproduce your stacktrace. |
I get the correct (your) stack trace, if I test it with the eclipse 4.2 (juno). But using eclipse 3.8 (juno without e4) I still get this wrong stack trace. |
Reproduced this bug with the stand-alone Jnario Compiler: Check out the project and run default ant target. Here are some snippets:
JUnit report:
The line 35 doesn't point to the
|
Same problem with Jnario 0.5.1.201307292301 |
If within a table forEach closure an exception get thrown, no correct stacktrace (for the first erroneous table row) get shown.
Example:
Produces:
As you can see, the first interesting line in the stack trace is
But the line 41 is not the line, the exception thrown.
I would expect to see a "caused by" exception below this stack trace with the original exception thrown, so the cause of the exception could be investigated easier.
The text was updated successfully, but these errors were encountered: