Skip to content

Commit

Permalink
Minor test refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
armandino committed May 25, 2024
1 parent 2e83ad0 commit f420c82
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void supplyPojoViaGenerator() {
.isSameAs(address);

// should be populated due to default generator hint
assertThat(address.getAddress()).isNotBlank();
assertThat(address.getStreet()).isNotBlank();
assertThat(address.getCity()).isNotBlank();
assertThat(address.getCountry()).isNotBlank();
assertThat(address.getPhoneNumbers()).isNotEmpty();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void userSuppliedStringClassGenerator() {

assertThat(person.getName()).isEqualTo(expectedName);
assertThat(person.getAddress().getCity()).startsWith(prefix);
assertThat(person.getAddress().getAddress()).startsWith(prefix);
assertThat(person.getAddress().getStreet()).startsWith(prefix);
assertThat(person.getAddress().getCountry()).startsWith(prefix);

person.getAddress().getPhoneNumbers().forEach(phone -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ void ignoredSelectorWithScope() {
.create();

assertThat(person.getName()).isNotNull();
assertThat(person.getAddress().getAddress()).isNull();
assertThat(person.getAddress().getStreet()).isNull();
assertThat(person.getAddress().getCity()).isNull();
assertThat(person.getAddress().getCountry()).isNull();
assertThat(person.getAddress().getPhoneNumbers()).extracting(Phone::getNumber).containsOnlyNulls();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void nullableWithSelectorScope() {
nullableCountryCode.addAll(phoneNumbers.stream().map(Phone::getCountryCode).collect(toSet()));
nullablePhoneNumber.addAll(phoneNumbers.stream().map(Phone::getNumber).collect(toSet()));
nonNullableResults.add(person.getName());
nonNullableResults.add(address.getAddress());
nonNullableResults.add(address.getStreet());
nonNullableResults.add(address.getCity());
nonNullableResults.add(address.getCountry());
nonNullableResults.addAll(Arrays.stream(person.getPets()).map(Pet::getName).collect(toSet()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void verifyToScope(final ConvertibleToScope selector) {
}

private static void assertExpectedStrings(final Address result) {
assertThat(result.getAddress()).isNotEqualTo(FOO);
assertThat(result.getStreet()).isNotEqualTo(FOO);
assertThat(result.getCity()).isNotEqualTo(FOO);
assertThat(result.getCountry()).isNotEqualTo(FOO);
assertThat(result.getPhoneNumbers()).allSatisfy(phone ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ String expectedMessage() {
-> The origin selector 'all(String)' matches multiple values.
It's not clear which of these values should be used:
-> Match 1: field Address.address
-> Match 1: field Address.street
<1:Address: String address>
<1:Address: String street>
└──<0:Address>
-> Match 2: field Address.city
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected void verify(Person result) {

assertThat(result.getAddress()).isNotNull()
.satisfies(address -> {
assertThat(address.getAddress()).isNotBlank();
assertThat(address.getStreet()).isNotBlank();
assertThat(address.getCity()).isNotBlank();
assertThat(address.getCountry()).isNotBlank();
assertThat(address.getPhoneNumbers())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void person() {
├──<1:Person: UUID uuid; setUuid(UUID)>
├──<1:Person: String name; setName(String)>
├──<1:Person: Address address; setAddress(Address)>
│ ├──<2:Address: String address; setAddress(String)>
│ ├──<2:Address: String street; setStreet(String)>
│ ├──<2:Address: String city; setCity(String)>
│ ├──<2:Address: String country; setCountry(String)>
│ └──<2:Address: List<Phone> phoneNumbers; setPhoneNumbers(List<Phone>)>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ void isFullyPopulatedMap() {

private static Address createAddressFilledWithFoo() {
return Address.builder()
.address(FOO)
.street(FOO)
.city(FOO)
.country(FOO)
.phoneNumbers(Arrays.asList(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
@Builder(toBuilder = true)
@Pojo
public class Address {
private String address;
private String street;
private String city;
private String country;
private List<Phone> phoneNumbers;
Expand Down

0 comments on commit f420c82

Please sign in to comment.