Skip to content

Commit 107f76e

Browse files
Use assertj-assertions-generator 2.2.1
1 parent 573e562 commit 107f76e

21 files changed

+231
-59
lines changed

assertions-examples/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,11 @@
241241
<artifactId>assertj-core</artifactId>
242242
<version>${assertj-core.version}</version>
243243
</dependency>
244+
<dependency>
245+
<groupId>org.assertj</groupId>
246+
<artifactId>assertj-assertions-generator</artifactId>
247+
<version>2.2.1</version>
248+
</dependency>
244249
</dependencies>
245250
</plugin>
246251
<plugin>

assertions-examples/src/test/generated-assertions/com/google/common/net/AbstractInternetDomainNameAssert.java

Lines changed: 169 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package com.google.common.net;
22

3+
import java.util.Objects;
34
import org.assertj.core.api.AbstractObjectAssert;
45
import org.assertj.core.internal.Iterables;
5-
import org.assertj.core.util.Objects;
66

77
/**
88
* Abstract base class for {@link InternetDomainName} specific assertions - Generated by CustomAssertionGenerator.
@@ -126,6 +126,114 @@ public S isNotPublicSuffix() {
126126
return myself;
127127
}
128128

129+
/**
130+
* Verifies that the actual InternetDomainName has registry suffix.
131+
* @return this assertion object.
132+
* @throws AssertionError - if the actual InternetDomainName does not have registry suffix.
133+
*/
134+
public S hasRegistrySuffix() {
135+
// check that actual InternetDomainName we want to make assertions on is not null.
136+
isNotNull();
137+
138+
// check that property call/field access is true
139+
if (!actual.hasRegistrySuffix()) {
140+
failWithMessage("\nExpecting that actual InternetDomainName has registry suffix but does not have.");
141+
}
142+
143+
// return the current assertion for method chaining
144+
return myself;
145+
}
146+
147+
/**
148+
* Verifies that the actual InternetDomainName does not have registry suffix.
149+
* @return this assertion object.
150+
* @throws AssertionError - if the actual InternetDomainName has registry suffix.
151+
*/
152+
public S doesNotHaveRegistrySuffix() {
153+
// check that actual InternetDomainName we want to make assertions on is not null.
154+
isNotNull();
155+
156+
// check that property call/field access is false
157+
if (actual.hasRegistrySuffix()) {
158+
failWithMessage("\nExpecting that actual InternetDomainName does not have registry suffix but has.");
159+
}
160+
161+
// return the current assertion for method chaining
162+
return myself;
163+
}
164+
165+
/**
166+
* Verifies that the actual InternetDomainName is registry suffix.
167+
* @return this assertion object.
168+
* @throws AssertionError - if the actual InternetDomainName is not registry suffix.
169+
*/
170+
public S isRegistrySuffix() {
171+
// check that actual InternetDomainName we want to make assertions on is not null.
172+
isNotNull();
173+
174+
// check that property call/field access is true
175+
if (!actual.isRegistrySuffix()) {
176+
failWithMessage("\nExpecting that actual InternetDomainName is registry suffix but is not.");
177+
}
178+
179+
// return the current assertion for method chaining
180+
return myself;
181+
}
182+
183+
/**
184+
* Verifies that the actual InternetDomainName is not registry suffix.
185+
* @return this assertion object.
186+
* @throws AssertionError - if the actual InternetDomainName is registry suffix.
187+
*/
188+
public S isNotRegistrySuffix() {
189+
// check that actual InternetDomainName we want to make assertions on is not null.
190+
isNotNull();
191+
192+
// check that property call/field access is false
193+
if (actual.isRegistrySuffix()) {
194+
failWithMessage("\nExpecting that actual InternetDomainName is not registry suffix but is.");
195+
}
196+
197+
// return the current assertion for method chaining
198+
return myself;
199+
}
200+
201+
/**
202+
* Verifies that the actual InternetDomainName is top domain under registry suffix.
203+
* @return this assertion object.
204+
* @throws AssertionError - if the actual InternetDomainName is not top domain under registry suffix.
205+
*/
206+
public S isTopDomainUnderRegistrySuffix() {
207+
// check that actual InternetDomainName we want to make assertions on is not null.
208+
isNotNull();
209+
210+
// check that property call/field access is true
211+
if (!actual.isTopDomainUnderRegistrySuffix()) {
212+
failWithMessage("\nExpecting that actual InternetDomainName is top domain under registry suffix but is not.");
213+
}
214+
215+
// return the current assertion for method chaining
216+
return myself;
217+
}
218+
219+
/**
220+
* Verifies that the actual InternetDomainName is not top domain under registry suffix.
221+
* @return this assertion object.
222+
* @throws AssertionError - if the actual InternetDomainName is top domain under registry suffix.
223+
*/
224+
public S isNotTopDomainUnderRegistrySuffix() {
225+
// check that actual InternetDomainName we want to make assertions on is not null.
226+
isNotNull();
227+
228+
// check that property call/field access is false
229+
if (actual.isTopDomainUnderRegistrySuffix()) {
230+
failWithMessage("\nExpecting that actual InternetDomainName is not top domain under registry suffix but is.");
231+
}
232+
233+
// return the current assertion for method chaining
234+
return myself;
235+
}
236+
129237
/**
130238
* Verifies that the actual InternetDomainName is top private domain.
131239
* @return this assertion object.
@@ -198,6 +306,42 @@ public S isNotUnderPublicSuffix() {
198306
return myself;
199307
}
200308

309+
/**
310+
* Verifies that the actual InternetDomainName is under registry suffix.
311+
* @return this assertion object.
312+
* @throws AssertionError - if the actual InternetDomainName is not under registry suffix.
313+
*/
314+
public S isUnderRegistrySuffix() {
315+
// check that actual InternetDomainName we want to make assertions on is not null.
316+
isNotNull();
317+
318+
// check that property call/field access is true
319+
if (!actual.isUnderRegistrySuffix()) {
320+
failWithMessage("\nExpecting that actual InternetDomainName is under registry suffix but is not.");
321+
}
322+
323+
// return the current assertion for method chaining
324+
return myself;
325+
}
326+
327+
/**
328+
* Verifies that the actual InternetDomainName is not under registry suffix.
329+
* @return this assertion object.
330+
* @throws AssertionError - if the actual InternetDomainName is under registry suffix.
331+
*/
332+
public S isNotUnderRegistrySuffix() {
333+
// check that actual InternetDomainName we want to make assertions on is not null.
334+
isNotNull();
335+
336+
// check that property call/field access is false
337+
if (actual.isUnderRegistrySuffix()) {
338+
failWithMessage("\nExpecting that actual InternetDomainName is not under registry suffix but is.");
339+
}
340+
341+
// return the current assertion for method chaining
342+
return myself;
343+
}
344+
201345
/**
202346
* Verifies that the actual InternetDomainName's name is equal to the given one.
203347
* @param name the given name to compare the actual InternetDomainName's name to.
@@ -213,7 +357,7 @@ public S hasName(String name) {
213357

214358
// null safe check
215359
String actualName = org.assertj.core.util.introspection.FieldSupport.EXTRACTION.fieldValue("name", String.class, actual);
216-
if (!Objects.areEqual(actualName, name)) {
360+
if (!Objects.deepEquals(actualName, name)) {
217361
failWithMessage(assertjErrorMessage, actual, name, actualName);
218362
}
219363

@@ -397,4 +541,27 @@ public S hasPublicSuffixIndex(int publicSuffixIndex) {
397541
return myself;
398542
}
399543

544+
/**
545+
* Verifies that the actual InternetDomainName's registrySuffixIndex is equal to the given one.
546+
* @param registrySuffixIndex the given registrySuffixIndex to compare the actual InternetDomainName's registrySuffixIndex to.
547+
* @return this assertion object.
548+
* @throws AssertionError - if the actual InternetDomainName's registrySuffixIndex is not equal to the given one.
549+
*/
550+
public S hasRegistrySuffixIndex(int registrySuffixIndex) {
551+
// check that actual InternetDomainName we want to make assertions on is not null.
552+
isNotNull();
553+
554+
// overrides the default error message with a more explicit one
555+
String assertjErrorMessage = "\nExpecting registrySuffixIndex of:\n <%s>\nto be:\n <%s>\nbut was:\n <%s>";
556+
557+
// check
558+
int actualRegistrySuffixIndex = org.assertj.core.util.introspection.FieldSupport.EXTRACTION.fieldValue("registrySuffixIndex", int.class, actual);
559+
if (actualRegistrySuffixIndex != registrySuffixIndex) {
560+
failWithMessage(assertjErrorMessage, actual, registrySuffixIndex, actualRegistrySuffixIndex);
561+
}
562+
563+
// return the current assertion for method chaining
564+
return myself;
565+
}
566+
400567
}

assertions-examples/src/test/generated-assertions/org/apache/commons/lang3/exception/AbstractContextedRuntimeExceptionAssert.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package org.apache.commons.lang3.exception;
22

3+
import java.util.Objects;
34
import org.assertj.core.api.AbstractObjectAssert;
45
import org.assertj.core.internal.Iterables;
5-
import org.assertj.core.util.Objects;
66

77
/**
88
* Abstract base class for {@link ContextedRuntimeException} specific assertions - Generated by CustomAssertionGenerator.
@@ -339,7 +339,7 @@ public S hasMessage(String message) {
339339

340340
// null safe check
341341
String actualMessage = actual.getMessage();
342-
if (!Objects.areEqual(actualMessage, message)) {
342+
if (!Objects.deepEquals(actualMessage, message)) {
343343
failWithMessage(assertjErrorMessage, actual, message, actualMessage);
344344
}
345345

@@ -362,7 +362,7 @@ public S hasRawMessage(String rawMessage) {
362362

363363
// null safe check
364364
String actualRawMessage = actual.getRawMessage();
365-
if (!Objects.areEqual(actualRawMessage, rawMessage)) {
365+
if (!Objects.deepEquals(actualRawMessage, rawMessage)) {
366366
failWithMessage(assertjErrorMessage, actual, rawMessage, actualRawMessage);
367367
}
368368

@@ -385,7 +385,7 @@ public S hasExceptionContext(ExceptionContext exceptionContext) {
385385

386386
// null safe check
387387
ExceptionContext actualExceptionContext = org.assertj.core.util.introspection.FieldSupport.EXTRACTION.fieldValue("exceptionContext", ExceptionContext.class, actual);
388-
if (!Objects.areEqual(actualExceptionContext, exceptionContext)) {
388+
if (!Objects.deepEquals(actualExceptionContext, exceptionContext)) {
389389
failWithMessage(assertjErrorMessage, actual, exceptionContext, actualExceptionContext);
390390
}
391391

assertions-examples/src/test/generated-assertions/org/assertj/examples/data/AbstractArtWorkAssert.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package org.assertj.examples.data;
22

3+
import java.util.Objects;
34
import org.assertj.core.api.AbstractObjectAssert;
4-
import org.assertj.core.util.Objects;
55

66
/**
77
* Abstract base class for {@link ArtWork} specific assertions - Generated by CustomAssertionGenerator.
@@ -32,7 +32,7 @@ public S hasCreator(String creator) {
3232

3333
// null safe check
3434
String actualCreator = actual.getCreator();
35-
if (!Objects.areEqual(actualCreator, creator)) {
35+
if (!Objects.deepEquals(actualCreator, creator)) {
3636
failWithMessage(assertjErrorMessage, actual, creator, actualCreator);
3737
}
3838

assertions-examples/src/test/generated-assertions/org/assertj/examples/data/AbstractBasketBallPlayerAssert.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package org.assertj.examples.data;
22

3+
import java.util.Objects;
34
import org.assertj.core.api.AbstractObjectAssert;
45
import org.assertj.core.api.Assertions;
56
import org.assertj.core.internal.Iterables;
6-
import org.assertj.core.util.Objects;
77

88
/**
99
* Abstract base class for {@link BasketBallPlayer} specific assertions - Generated by CustomAssertionGenerator.
@@ -58,7 +58,7 @@ public S hasName(Name name) throws org.assertj.examples.exception.NameException
5858

5959
// null safe check
6060
Name actualName = actual.getName();
61-
if (!Objects.areEqual(actualName, name)) {
61+
if (!Objects.deepEquals(actualName, name)) {
6262
failWithMessage(assertjErrorMessage, actual, name, actualName);
6363
}
6464

@@ -316,7 +316,7 @@ public S hasTeam(String team) {
316316

317317
// null safe check
318318
String actualTeam = actual.getTeam();
319-
if (!Objects.areEqual(actualTeam, team)) {
319+
if (!Objects.deepEquals(actualTeam, team)) {
320320
failWithMessage(assertjErrorMessage, actual, team, actualTeam);
321321
}
322322

assertions-examples/src/test/generated-assertions/org/assertj/examples/data/AbstractBookAssert.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package org.assertj.examples.data;
22

3+
import java.util.Objects;
34
import org.assertj.core.api.AbstractObjectAssert;
45
import org.assertj.core.api.Assertions;
5-
import org.assertj.core.util.Objects;
66

77
/**
88
* Abstract base class for {@link Book} specific assertions - Generated by CustomAssertionGenerator.
@@ -105,7 +105,7 @@ public S hasTitle(Book.Title title) {
105105

106106
// null safe check
107107
Book.Title actualTitle = actual.getTitle();
108-
if (!Objects.areEqual(actualTitle, title)) {
108+
if (!Objects.deepEquals(actualTitle, title)) {
109109
failWithMessage(assertjErrorMessage, actual, title, actualTitle);
110110
}
111111

@@ -128,7 +128,7 @@ public S hasRealAuthor(String realAuthor) {
128128

129129
// null safe check
130130
String actualRealAuthor = org.assertj.core.util.introspection.FieldSupport.EXTRACTION.fieldValue("realAuthor", String.class, actual);
131-
if (!Objects.areEqual(actualRealAuthor, realAuthor)) {
131+
if (!Objects.deepEquals(actualRealAuthor, realAuthor)) {
132132
failWithMessage(assertjErrorMessage, actual, realAuthor, actualRealAuthor);
133133
}
134134

assertions-examples/src/test/generated-assertions/org/assertj/examples/data/AbstractBookTitleAssert.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package org.assertj.examples.data;
22

3+
import java.util.Objects;
34
import org.assertj.core.api.AbstractObjectAssert;
4-
import org.assertj.core.util.Objects;
55

66
/**
77
* Abstract base class for {@link Book.Title} specific assertions - Generated by CustomAssertionGenerator.
@@ -32,7 +32,7 @@ public S hasTitle(String title) {
3232

3333
// null safe check
3434
String actualTitle = actual.getTitle();
35-
if (!Objects.areEqual(actualTitle, title)) {
35+
if (!Objects.deepEquals(actualTitle, title)) {
3636
failWithMessage(assertjErrorMessage, actual, title, actualTitle);
3737
}
3838

assertions-examples/src/test/generated-assertions/org/assertj/examples/data/AbstractClassUsingDifferentClassesWithSameNameAssert.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package org.assertj.examples.data;
22

3+
import java.util.Objects;
34
import org.assertj.core.api.AbstractObjectAssert;
4-
import org.assertj.core.util.Objects;
55

66
/**
77
* Abstract base class for {@link ClassUsingDifferentClassesWithSameName} specific assertions - Generated by CustomAssertionGenerator.
@@ -32,7 +32,7 @@ public S hasMovieTeam(org.assertj.examples.data.movie.Team movieTeam) {
3232

3333
// null safe check
3434
org.assertj.examples.data.movie.Team actualMovieTeam = actual.getMovieTeam();
35-
if (!Objects.areEqual(actualMovieTeam, movieTeam)) {
35+
if (!Objects.deepEquals(actualMovieTeam, movieTeam)) {
3636
failWithMessage(assertjErrorMessage, actual, movieTeam, actualMovieTeam);
3737
}
3838

@@ -55,7 +55,7 @@ public S hasTeam(Team team) {
5555

5656
// null safe check
5757
Team actualTeam = actual.getTeam();
58-
if (!Objects.areEqual(actualTeam, team)) {
58+
if (!Objects.deepEquals(actualTeam, team)) {
5959
failWithMessage(assertjErrorMessage, actual, team, actualTeam);
6060
}
6161

assertions-examples/src/test/generated-assertions/org/assertj/examples/data/AbstractEmployeeAssert.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package org.assertj.examples.data;
22

3-
import org.assertj.core.util.Objects;
3+
import java.util.Objects;
44

55
/**
66
* Abstract base class for {@link Employee} specific assertions - Generated by CustomAssertionGenerator.
@@ -31,7 +31,7 @@ public S hasCompany(String company) {
3131

3232
// null safe check
3333
String actualCompany = actual.getCompany();
34-
if (!Objects.areEqual(actualCompany, company)) {
34+
if (!Objects.deepEquals(actualCompany, company)) {
3535
failWithMessage(assertjErrorMessage, actual, company, actualCompany);
3636
}
3737

@@ -54,7 +54,7 @@ public S hasRank(String rank) {
5454

5555
// null safe check
5656
String actualRank = actual.rank;
57-
if (!Objects.areEqual(actualRank, rank)) {
57+
if (!Objects.deepEquals(actualRank, rank)) {
5858
failWithMessage(assertjErrorMessage, actual, rank, actualRank);
5959
}
6060

0 commit comments

Comments
 (0)