Skip to content

Commit 2d542bd

Browse files
committed
Remove dependency to javax.annotation-api.
1 parent 637c182 commit 2d542bd

File tree

5 files changed

+31
-9
lines changed

5 files changed

+31
-9
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package ${package};
2+
${imports}
3+
/**
4+
* {@link ${class_to_assert}} specific assertions - Generated by CustomAssertionGenerator.
5+
*/
6+
@edu.hm.hafner.util.Generated(value="assertj-assertions-generator")
7+
public class ${custom_assertion_class} extends AbstractObjectAssert<${custom_assertion_class}, ${class_to_assert}> {
8+
9+
/**
10+
* Creates a new <code>{@link ${custom_assertion_class}}</code> to make assertions on actual ${class_to_assert}.
11+
* @param actual the ${class_to_assert} we want to make assertions on.
12+
*/
13+
public ${custom_assertion_class}(${class_to_assert} actual) {
14+
super(actual, ${custom_assertion_class}.class);
15+
}
16+
17+
/**
18+
* An entry point for ${custom_assertion_class} to follow AssertJ standard <code>assertThat()</code> statements.<br>
19+
* With a static import, one can write directly: <code>assertThat(my${class_to_assert})</code> and get specific assertion with code completion.
20+
* @param actual the ${class_to_assert} we want to make assertions on.
21+
* @return a new <code>{@link ${custom_assertion_class}}</code>
22+
*/
23+
@org.assertj.core.util.CheckReturnValue
24+
public static ${custom_assertion_class} assertThat(${class_to_assert} actual) {
25+
return new ${custom_assertion_class}(actual);
26+
}

etc/assertj-templates/assertions_entry_point_class_template.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ package ${package};
55
* type-specific assertion objects.
66
*/
77
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings("NM")
8-
@javax.annotation.Generated(value="assertj-assertions-generator")
8+
@edu.hm.hafner.util.Generated(value="assertj-assertions-generator")
99
public class Assertions extends org.assertj.core.api.Assertions {
1010
${all_assertions_entry_points}
1111
/**

etc/assertj-templates/soft_assertions_entry_point_class_template.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ package ${package};
44
* Entry point for soft assertions of different data types.
55
*/
66
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings("NM")
7-
@javax.annotation.Generated(value="assertj-assertions-generator")
7+
@edu.hm.hafner.util.Generated(value="assertj-assertions-generator")
88
public class SoftAssertions extends org.assertj.core.api.AutoCloseableSoftAssertions {
99
${all_assertions_entry_points}
1010
}

pom.xml

+1-5
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,6 @@
136136
</dependencyManagement>
137137

138138
<dependencies>
139-
<dependency>
140-
<groupId>javax.annotation</groupId>
141-
<artifactId>javax.annotation-api</artifactId>
142-
<version>${javax.annotation-api.version}</version>
143-
</dependency>
144139
<dependency>
145140
<groupId>com.github.spotbugs</groupId>
146141
<artifactId>spotbugs-annotations</artifactId>
@@ -487,6 +482,7 @@
487482
<assertionsEntryPointClass>assertions_entry_point_class_template.txt</assertionsEntryPointClass>
488483
<softEntryPointAssertionClass>soft_assertions_entry_point_class_template.txt</softEntryPointAssertionClass>
489484
<objectAssertion>has_assertion_template.txt</objectAssertion>
485+
<assertionClass>assertion_class_template.txt</assertionClass>
490486
</templates>
491487
<packages>
492488
<package>edu.hm.hafner.util</package>

src/main/java/edu/hm/hafner/util/Generated.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

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

0 commit comments

Comments
 (0)