PersonTextCommandConverterTest.java 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * Copyright (c) Andrew Grant of Carrick Software 30/03/2025, 13:45. All rights reserved.
  3. *
  4. */
  5. package scot.carricksoftware.grants.converters.text.persontext;
  6. import org.junit.jupiter.api.BeforeEach;
  7. import org.junit.jupiter.api.Test;
  8. import scot.carricksoftware.grants.commands.text.PersonTextCommand;
  9. import scot.carricksoftware.grants.commands.text.PersonTextCommandImpl;
  10. import scot.carricksoftware.grants.domains.people.Person;
  11. import scot.carricksoftware.grants.domains.text.PersonText;
  12. import static org.junit.jupiter.api.Assertions.assertEquals;
  13. import static org.junit.jupiter.api.Assertions.assertNotNull;
  14. import static scot.carricksoftware.grants.GenerateCertificateRandomValues.GetRandomString;
  15. import static scot.carricksoftware.grants.GenerateRandomNumberValues.GetRandomLong;
  16. import static scot.carricksoftware.grants.GenerateRandomPeopleValues.GetRandomPerson;
  17. class PersonTextCommandConverterTest {
  18. private PersonTextCommandConverter converter;
  19. @BeforeEach
  20. void setUp() {
  21. converter = new PersonTextCommandConverterImpl();
  22. }
  23. @Test
  24. void covertTest() {
  25. Long Id = GetRandomLong();
  26. Person person = GetRandomPerson();
  27. Long order = GetRandomLong();
  28. Long level = GetRandomLong();
  29. String heading = GetRandomString();
  30. String content = GetRandomString();
  31. PersonTextCommand source = new PersonTextCommandImpl();
  32. source.setId(Id);
  33. source.setPerson(person);
  34. source.setOrder(order);
  35. source.setLevel(level);
  36. source.setHeading(heading);
  37. source.setOrder(order);
  38. source.setContent(content);
  39. PersonText target = converter.convert(source);
  40. assertNotNull(target);
  41. assertEquals(Id, target.getId());
  42. assertEquals(person, target.getPerson());
  43. assertEquals(order, target.getOrder());
  44. assertEquals(level, target.getLevel());
  45. assertEquals(heading, target.getHeading());
  46. assertEquals(content, target.getContent());
  47. }
  48. }