-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Request.classes(newTestClass).getRunner().getDescription() #1320
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
Comments
For the sake of a complete example: @RunWith(Suite.class)
@SuiteClasses({
XMSectionTest.Basic.class
})
public class XMSectionTest {
public static class Basic {
@Test
public void test() {
Assert.fail("foo");
}
}
public static void main(String... args) {
Class<?> testClass = XMSectionTest.class;
System.out.println("Request.classes(testClass):");
printTree(Request.classes(testClass).getRunner().getDescription());
System.out.println();
System.out.println("Request.aClass(testClass):");
printTree(Request.aClass(testClass).getRunner().getDescription());
System.out.println();
}
private static void printTree(Description description) {
printTree(description, "- ");
}
private static void printTree(Description description, String indentation) {
System.out.print(indentation);
System.out.println(description + " (" + System.identityHashCode(description) + ")");
for (Description child : description.getChildren()) {
printTree(child, " " + indentation);
}
}
} Executing the main method prints:
So, there is an intended difference: When using Why would the second be "uncomfortable"? |
I think it makes sense for the root |
I think "classes" sounds good! |
…shouldn't be null (junit-team#1377) Fixes junit-team#1320
With a quite straightforward testclass annotated
@RunWith(Suite.class)
@SuiteClasses({
XMSectionTest.Basic.class
})
public class XMSectionTest {
...
I obtain for Request.classes(testClass).getRunner().getDescription() the value null,
whereas for Request.aClass(testClass).getRunner().getDescription()
I obtain eu.simuline.arithmetics.left2right.XMSectionTest
Hm,.... the first seems a bug to me,
whereas the second one.. seems to me at least uncomfortable,
because I think the description shall reflect the structure of the request and not its origin.
The text was updated successfully, but these errors were encountered: