io.github.mrtimeey.herodomainmodel.assertions.PersonalInformationAssert Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of object-finder Show documentation
Show all versions of object-finder Show documentation
Library for finding objects in complex data structures
package io.github.mrtimeey.herodomainmodel.assertions;
import io.github.mrtimeey.herodomainmodel.model.Identity;
import io.github.mrtimeey.herodomainmodel.model.PersonalInformation;
import org.assertj.core.api.AbstractObjectAssert;
import org.assertj.core.api.Assertions;
public class PersonalInformationAssert extends AbstractObjectAssert {
private SuperHeroAssert savedSuperHero;
public PersonalInformationAssert(PersonalInformation actual) {
super(actual, PersonalInformationAssert.class);
}
public PersonalInformationAssert(PersonalInformation actual, SuperHeroAssert superHero) {
super(actual, PersonalInformationAssert.class);
savedSuperHero = superHero;
}
public PersonalInformationAssert hasIdentity(Identity identity) {
isNotNull();
Assertions.assertThat(actual.identity()).isEqualTo(identity);
return this;
}
public PersonalInformationAssert hasCitizenship(String citizenship) {
isNotNull();
Assertions.assertThat(actual.citizenship()).isEqualTo(citizenship);
return this;
}
public SuperHeroAssert mapToSuperHero() {
if (savedSuperHero == null) {
failWithMessage("Invalid use of mapping! Can only be called if SuperHero was visited!");
}
return savedSuperHero;
}
}