Skip to content
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

feat(#199): Adds package annotation for affected tests #258

Merged
merged 6 commits into from
Nov 10, 2017

Conversation

lordofthejars
Copy link
Member

@lordofthejars lordofthejars commented Nov 2, 2017

Short description of what this resolves:

Adds package annotation for affected tests

Changes proposed in this pull request:

  • Adds @ComponentUnderTest annotation to set which production classes are affected by annotated tests. Useful for black box testing.

  • Adds library to scan classes of given package. It is a really light library (no external dependencies), offers a lot of operations that we might use in the future. Also maybe it can be used as a substitution of Javassist.

Fixes #199

Copy link
Member

@bartoszmajsak bartoszmajsak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff @lordofthejars. Few minor things you could fix in between the conferences ;)


}

private ComponentUnderTest[] getAllAnnotations(JavaClass testJavaClass) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor detail - fix it when you will find time - instead of generic getAllAnnotations - findComponentsUnderTests?

}
}
}

private void addToIndex(JavaElement javaElement, String[] imports) {
private List<String> calculateManualAddedDependencies(JavaClass testJavaClass) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

calculateManualAddedDependencies -> calculateManuallyAddedDependencies


JavaAssistClass(CtClass classReference) {
imports = findImports(classReference);
className = classReference.getName();
this.classReference = classReference;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency can we prefix all with this.?

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Documented
public @interface ComponentsUnderTest {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no javadoc nor documentation description

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's implicitly used for Java8+ as @repeatable annotation, and we don't really support any lower version of JDK right now

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I know. I just thought that it would be nice to have an example/doc of this annotation as well. But I don't really insist on it ;-)

@bartoszmajsak bartoszmajsak merged commit e472cb3 into arquillian:master Nov 10, 2017
@lordofthejars lordofthejars deleted the issue_199 branch November 10, 2017 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Smart Testing annotations for Affected
3 participants