DeathCertificateCommandConverterPersonTest.java 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Copyright (c) Andrew Grant of Carrick Software 24/03/2025, 19:02. All rights reserved.
  3. *
  4. */
  5. package scot.carricksoftware.grants.converters.certificates.deathcertificates;
  6. import org.junit.jupiter.api.BeforeEach;
  7. import org.junit.jupiter.api.Test;
  8. import scot.carricksoftware.grants.commands.certificates.deathcertificates.DeathCertificateCommand;
  9. import scot.carricksoftware.grants.commands.certificates.deathcertificates.DeathCertificateCommandImpl;
  10. import scot.carricksoftware.grants.domains.certificates.DeathCertificate;
  11. import scot.carricksoftware.grants.domains.people.Person;
  12. import static org.junit.jupiter.api.Assertions.assertEquals;
  13. import static scot.carricksoftware.grants.GenerateRandomNumberValues.GetRandomLong;
  14. import static scot.carricksoftware.grants.GenerateRandomPeopleValues.GetRandomPerson;
  15. class DeathCertificateCommandConverterPersonTest {
  16. private DeathCertificateCommandConverter converter;
  17. @BeforeEach
  18. void setUp() {
  19. converter = new DeathCertificateCommandConverterImpl();
  20. }
  21. @Test
  22. void convertTest() {
  23. Long id = GetRandomLong();
  24. Person person = GetRandomPerson();
  25. Person father = GetRandomPerson();
  26. Person informant = GetRandomPerson();
  27. Person mother = GetRandomPerson();
  28. Person spouse = GetRandomPerson();
  29. DeathCertificateCommand source = new DeathCertificateCommandImpl();
  30. source.setId(id);
  31. source.setDeceased(person);
  32. source.setFather(father);
  33. source.setInformant(informant);
  34. source.setMother(mother);
  35. source.setSpouse(spouse);
  36. DeathCertificate target = converter.convert(source);
  37. assert target != null;
  38. assertEquals(id,target.getId());
  39. assertEquals(person,target.getDeceased());
  40. assertEquals(father,target.getFather());
  41. assertEquals(informant,target.getInformant());
  42. assertEquals(mother,target.getMother());
  43. assertEquals(spouse,target.getSpouse());
  44. }
  45. }