Skip to content

Commit

Permalink
Remove dependency to javax.annotation-api.
Browse files Browse the repository at this point in the history
  • Loading branch information
uhafner committed Oct 13, 2023
1 parent 637c182 commit 2d542bd
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 9 deletions.
26 changes: 26 additions & 0 deletions etc/assertj-templates/assertion_class_template.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package ${package};
${imports}
/**
* {@link ${class_to_assert}} specific assertions - Generated by CustomAssertionGenerator.
*/
@edu.hm.hafner.util.Generated(value="assertj-assertions-generator")
public class ${custom_assertion_class} extends AbstractObjectAssert<${custom_assertion_class}, ${class_to_assert}> {

/**
* Creates a new <code>{@link ${custom_assertion_class}}</code> to make assertions on actual ${class_to_assert}.
* @param actual the ${class_to_assert} we want to make assertions on.
*/
public ${custom_assertion_class}(${class_to_assert} actual) {
super(actual, ${custom_assertion_class}.class);
}

/**
* An entry point for ${custom_assertion_class} to follow AssertJ standard <code>assertThat()</code> statements.<br>
* With a static import, one can write directly: <code>assertThat(my${class_to_assert})</code> and get specific assertion with code completion.
* @param actual the ${class_to_assert} we want to make assertions on.
* @return a new <code>{@link ${custom_assertion_class}}</code>
*/
@org.assertj.core.util.CheckReturnValue
public static ${custom_assertion_class} assertThat(${class_to_assert} actual) {
return new ${custom_assertion_class}(actual);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package ${package};
* type-specific assertion objects.
*/
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings("NM")
@javax.annotation.Generated(value="assertj-assertions-generator")
@edu.hm.hafner.util.Generated(value="assertj-assertions-generator")
public class Assertions extends org.assertj.core.api.Assertions {
${all_assertions_entry_points}
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package ${package};
* Entry point for soft assertions of different data types.
*/
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings("NM")
@javax.annotation.Generated(value="assertj-assertions-generator")
@edu.hm.hafner.util.Generated(value="assertj-assertions-generator")
public class SoftAssertions extends org.assertj.core.api.AutoCloseableSoftAssertions {
${all_assertions_entry_points}
}
6 changes: 1 addition & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,6 @@
</dependencyManagement>

<dependencies>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>${javax.annotation-api.version}</version>
</dependency>
<dependency>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-annotations</artifactId>
Expand Down Expand Up @@ -487,6 +482,7 @@
<assertionsEntryPointClass>assertions_entry_point_class_template.txt</assertionsEntryPointClass>
<softEntryPointAssertionClass>soft_assertions_entry_point_class_template.txt</softEntryPointAssertionClass>
<objectAssertion>has_assertion_template.txt</objectAssertion>
<assertionClass>assertion_class_template.txt</assertionClass>
</templates>
<packages>
<package>edu.hm.hafner.util</package>
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/edu/hm/hafner/util/Generated.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

/**
* This annotation is used to mark source code that has been generated or is somehow not relevant for style checking or
* code coverage analysis. This annotation is quite similar to the annotation @{@link javax.annotation.Generated}. The
* main difference is that it has class retention on so is available for tools that work on the bytecode (like JaCoCo,
* code coverage analysis. It is quite similar to the {@code javax.annotation.Generated} annotation. The
* main difference is that it has class retention on so is available for tools that work on bytecode (like JaCoCo,
* PIT, or SpotBugs).
*/
@Retention(CLASS)
Expand Down

0 comments on commit 2d542bd

Please sign in to comment.