PersonToStringTest.java 946 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * Copyright (c) 2025. Andrew Grant Carrick Software. All rights reserved
  3. *
  4. */
  5. package scot.carricksoftware.grantswriter.domains.people;
  6. import org.junit.jupiter.api.BeforeEach;
  7. import org.junit.jupiter.api.Test;
  8. import static org.junit.jupiter.api.Assertions.assertEquals;
  9. class PersonToStringTest {
  10. private Person person;
  11. @BeforeEach
  12. void setUp() {
  13. person = new Person();
  14. String firstName = "first";
  15. String lastName = "last";
  16. person.setFirstName(firstName);
  17. person.setLastName(lastName);
  18. person.setRecordedYearOfBirth("1953");
  19. }
  20. @Test
  21. void noCertifiedYearOfBirthTest() {
  22. person.setCertifiedYearOfBirth(null);
  23. assertEquals("last, first, (1953) -", person.toString());
  24. }
  25. @Test
  26. void certifiedYearOfBirthTest() {
  27. person.setCertifiedYearOfBirth("1955");
  28. assertEquals("last, first, 1955 -", person.toString());
  29. }
  30. }