Skip to content

Add @JavaTestMethod and @JavaTestClass annotations to Description when they are known by built-in runners #198

Open
@dsaff

Description

@dsaff

Description currently has methods getTestClass, getClassName, and getMethodName. These are lame implementations that depend on parsing information out of the description string that either (1) were already known at the time the Description was created, or (2) aren't there, because the Description doesn't refer to a Java code element at all.

There have been proposals (for example, in https://github.com/KentBeck/junit/pull/195) to further enrich this API with getTestMethod, etc. Instead, let's deprecate this way of doing things, and instead augment the implementation of the built-in Runners and classes that touch Java classes, so that they use the existing Annotation-based metadata mechanism on Description. Thus, for example, to get the Java class associated with a Description, one would use

Class<?> testClass = myDescription.getAnnotation(JavaTestClass.class).getValue();

We could then either deprecate the old Java-reflection-specific methods on Description, or port them over to use the new, clean Annotation implementation.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions