siom79 / japicmp

Comparison of two versions of a jar archive
https://siom79.github.io/japicmp
Apache License 2.0
708 stars 107 forks source link

Expand test coverage for compatibility changes related to annotations #396

Closed guillermocalvo closed 5 months ago

guillermocalvo commented 5 months ago

I updated test classes CtClassBuilder, CtMethodBuilder and CtFieldBuilder so that tests can create annotations with elements.

Example:

// Creates a test class with an empty annotation:
//     @MyAnnotation
//     class Test { }
CtClassBuilder.create().name("japicmp.Test").withAnnotation("japicmp.MyAnnotation");

// Creates a test class with an annotation that contains one element:
//     @MyAnnotation(foo = 1000)
//     class Test { }
CtClassBuilder.create().name("japicmp.Test").withAnnotation("japicmp.MyAnnotation", new CtElement("foo", 1000));

This allows for test scenarios where compatibility change ANNOTATION_MODIFIED should be reported.

Closes #385

siom79 commented 5 months ago

Thank you for the PR.