All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.mrtimeey.herodomainmodel.assertions.PersonalInformationAssert Maven / Gradle / Ivy

There is a newer version: 1.1.0
Show newest version
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;
   }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy