10000 api to modify created hierarchy of descriptors would help IDE integration · Issue #1077 · junit-team/junit4 · GitHub
[go: up one dir, main page]

Skip to content
api to modify created hierarchy of descriptors would help IDE integration #1077
@akozlova

Description

@akozlova

In IntelliJ IDEA test's tree is build upon descriptors hierarchy. So if one would like to change it, he need to change the descriptors hierarchy. In some simple cases it's done by the IDE. E.g. if user ask to run one test method for a test class, descriptor for class with exactly one child is created but the IDE hides the top level node with the following reflection abuse

 private static Description getFilteredDescription(Request request, Description description) throws NoSuchFieldException, IllegalAccessException {
    Field field;
    try {
      field = FilterRequest.class.getDeclaredField("fFilter");
    }
    catch (NoSuchFieldException e) {
      field = FilterRequest.class.getDeclaredField("filter");
    }
    field.setAccessible(true);
    final Filter filter = (Filter)field.get(request);
    final String filterDescription = filter.describe();
    if (filterDescription != null) {
      boolean isMethodFilter = filterDescription.startsWith("Method");
      if (isMethodFilter && canCompress(description)) return (Description)description.getChildren().get(0);   
    }
    return description;
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0