-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
364 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
...ferenceguide-chapter01/org/hibernate/validator/referenceguide/chapter01/CarTest_Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package org.hibernate.validator.referenceguide.chapter01; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static com.github.jinahya.assertj.validation.ValidationAssertions.assertThatBean; | ||
|
||
/** | ||
* . | ||
* | ||
* @see org.hibernate.validator.referenceguide.chapter01.CarTest | ||
*/ | ||
class CarTest_Test { | ||
|
||
/** | ||
* . | ||
* | ||
* @see CarTest#manufacturerIsNull() | ||
*/ | ||
@Test | ||
void manufacturerIsNull__() { | ||
final var car = new Car(null, "DD-AB-123", 4); | ||
assertThatBean(car) | ||
.isNotValid() | ||
.doesNotHaveValidProperty(Car_Constants.PROPERTY_MANUFACTURER) | ||
.hasValidProperty(Car_Constants.PROPERTY_LICENSE_PLATE) | ||
; | ||
} | ||
|
||
/** | ||
* . | ||
* | ||
* @see CarTest#licensePlateTooShort() | ||
*/ | ||
@Test | ||
void licensePlateTooShort__() { | ||
final var car = new Car("Morris", "D", 4); | ||
assertThatBean(car) | ||
.isNotValid() | ||
.doesNotHaveValidProperty(Car_Constants.PROPERTY_LICENSE_PLATE) | ||
.hasValidProperty(Car_Constants.PROPERTY_MANUFACTURER) | ||
.hasValidProperty(Car_Constants.PROPERTY_MANUFACTURER) | ||
; | ||
} | ||
|
||
/** | ||
* . | ||
* | ||
* @see CarTest#seatCountTooLow() | ||
*/ | ||
@Test | ||
void seatCountTooLow() { | ||
final var car = new Car("Morris", "DD-AB-123", 1); | ||
assertThatBean(car) | ||
.isNotValid() | ||
.doesNotHaveValidProperty(Car_Constants.PROPERTY_SEAT_COUNT) | ||
.hasValidProperty(Car_Constants.PROPERTY_MANUFACTURER) | ||
.hasValidProperty(Car_Constants.PROPERTY_LICENSE_PLATE) | ||
; | ||
} | ||
|
||
/** | ||
* . | ||
* | ||
* @see CarTest#carIsValid() | ||
*/ | ||
@Test | ||
void carIsValid() { | ||
final var car = new Car("Morris", "DD-AB-123", 2); | ||
assertThatBean(car) | ||
.isValid() | ||
.hasValidProperty(Car_Constants.PROPERTY_LICENSE_PLATE) | ||
.hasValidProperty(Car_Constants.PROPERTY_MANUFACTURER) | ||
.hasValidProperty(Car_Constants.PROPERTY_SEAT_COUNT) | ||
; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.