|
@@ -13,16 +13,13 @@ import org.mockito.Mock;
|
|
|
import org.mockito.junit.jupiter.MockitoExtension;
|
|
import org.mockito.junit.jupiter.MockitoExtension;
|
|
|
import scot.carricksoftware.grants.commands.certificates.marriagecertificates.MarriageCertificateCommand;
|
|
import scot.carricksoftware.grants.commands.certificates.marriagecertificates.MarriageCertificateCommand;
|
|
|
import scot.carricksoftware.grants.commands.certificates.marriagecertificates.MarriageCertificateCommandImpl;
|
|
import scot.carricksoftware.grants.commands.certificates.marriagecertificates.MarriageCertificateCommandImpl;
|
|
|
-import scot.carricksoftware.grants.converters.certificates.marriagecertificates.helpers.MarriageCertificateBrideCommandConverter;
|
|
|
|
|
|
|
+import scot.carricksoftware.grants.converters.certificates.marriagecertificates.helpers.command.MarriageCertificateBrideCommandConverter;
|
|
|
|
|
+import scot.carricksoftware.grants.converters.certificates.marriagecertificates.helpers.command.MarriageCertificateCertificateCommandConverter;
|
|
|
|
|
+import scot.carricksoftware.grants.converters.certificates.marriagecertificates.helpers.command.MarriageCertificateGroomCommandConverter;
|
|
|
|
|
+import scot.carricksoftware.grants.converters.certificates.marriagecertificates.helpers.command.MarriageCertificateWitnessCommandConverter;
|
|
|
import scot.carricksoftware.grants.domains.certificates.MarriageCertificate;
|
|
import scot.carricksoftware.grants.domains.certificates.MarriageCertificate;
|
|
|
-import scot.carricksoftware.grants.enums.certificates.CertificateType;
|
|
|
|
|
|
|
|
|
|
-import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
|
|
|
-import static scot.carricksoftware.grants.GenerateCertificateRandomValues.GetRandomString;
|
|
|
|
|
-import static scot.carricksoftware.grants.GenerateRandomNumberValues.GetRandomLong;
|
|
|
|
|
-import static scot.carricksoftware.grants.GenerateRandomPeopleValues.GetRandomPerson;
|
|
|
|
|
-import static scot.carricksoftware.grants.GenerateRandomPlaceValues.GetRandomOrganisation;
|
|
|
|
|
-import static scot.carricksoftware.grants.GenerateRandomPlaceValues.GetRandomPlace;
|
|
|
|
|
|
|
+import static org.mockito.Mockito.verify;
|
|
|
|
|
|
|
|
@ExtendWith(MockitoExtension.class)
|
|
@ExtendWith(MockitoExtension.class)
|
|
|
class MarriageCertificateCommandConverterTest {
|
|
class MarriageCertificateCommandConverterTest {
|
|
@@ -32,74 +29,34 @@ class MarriageCertificateCommandConverterTest {
|
|
|
@Mock
|
|
@Mock
|
|
|
private MarriageCertificateBrideCommandConverter marriageCertificateBrideConverterMock;
|
|
private MarriageCertificateBrideCommandConverter marriageCertificateBrideConverterMock;
|
|
|
|
|
|
|
|
- @BeforeEach
|
|
|
|
|
- void setUp() {
|
|
|
|
|
- converter = new MarriageCertificateCommandConverterImpl(marriageCertificateBrideConverterMock);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @Test
|
|
|
|
|
- void convertTest() {
|
|
|
|
|
-
|
|
|
|
|
- MarriageCertificateCommand source = new MarriageCertificateCommandImpl();
|
|
|
|
|
|
|
+ @Mock
|
|
|
|
|
+ private MarriageCertificateGroomCommandConverter marriageCertificateGroomConverterMock;
|
|
|
|
|
|
|
|
- source.setCertificateDate(GetRandomString());
|
|
|
|
|
- source.setCertificateNumber(GetRandomString());
|
|
|
|
|
- source.setCertificateSource(GetRandomOrganisation());
|
|
|
|
|
- source.setCertificateType(CertificateType.EXTRACT);
|
|
|
|
|
- source.setFirstWitness(GetRandomPerson());
|
|
|
|
|
- source.setGroom(GetRandomPerson());
|
|
|
|
|
- source.setGroomAge(GetRandomString());
|
|
|
|
|
- source.setGroomCondition(GetRandomString());
|
|
|
|
|
- source.setGroomFather(GetRandomPerson());
|
|
|
|
|
- source.setGroomFatherRank(GetRandomString());
|
|
|
|
|
- source.setGroomRank(GetRandomString());
|
|
|
|
|
- source.setGroomUntrackedFather(GetRandomString());
|
|
|
|
|
- source.setGroomUntrackedResidence(GetRandomString());
|
|
|
|
|
- source.setGroomUsualResidence(GetRandomPlace());
|
|
|
|
|
- source.setId(GetRandomLong());
|
|
|
|
|
- source.setNumber(GetRandomString());
|
|
|
|
|
- source.setRegistrationAuthority(GetRandomOrganisation());
|
|
|
|
|
- source.setSecondWitness(GetRandomPerson());
|
|
|
|
|
- source.setUntrackedFirstWitness(GetRandomString());
|
|
|
|
|
- source.setUntrackedSecondWitness(GetRandomString());
|
|
|
|
|
- source.setUntrackedWhereMarried(GetRandomString());
|
|
|
|
|
- source.setVolume(GetRandomString());
|
|
|
|
|
- source.setWhenMarried(GetRandomString());
|
|
|
|
|
- source.setWhereMarried(GetRandomPlace());
|
|
|
|
|
|
|
+ @Mock
|
|
|
|
|
+ private MarriageCertificateWitnessCommandConverter marriageCertificateWitnessConverterMock;
|
|
|
|
|
|
|
|
|
|
+ @Mock
|
|
|
|
|
+ private MarriageCertificateCertificateCommandConverter marriageCertificateCertificateConverterMock;
|
|
|
|
|
|
|
|
- MarriageCertificate target = converter.convert(source);
|
|
|
|
|
|
|
+ private MarriageCertificateCommand marriageCertificateCommand;
|
|
|
|
|
|
|
|
- assert target != null;
|
|
|
|
|
- assertEquals(source.getCertificateDate(), target.getCertificateDate());
|
|
|
|
|
- assertEquals(source.getCertificateNumber(), target.getCertificateNumber());
|
|
|
|
|
- assertEquals(source.getCertificateSource(), target.getCertificateSource());
|
|
|
|
|
- assertEquals(source.getCertificateType(), target.getCertificateType());
|
|
|
|
|
- assertEquals(source.getFirstWitness(), target.getFirstWitness());
|
|
|
|
|
- assertEquals(source.getFirstWitness(), target.getFirstWitness());
|
|
|
|
|
- assertEquals(source.getGroom(), target.getGroom());
|
|
|
|
|
- assertEquals(source.getGroomAge(), target.getGroomAge());
|
|
|
|
|
- assertEquals(source.getGroomCondition(), target.getGroomCondition());
|
|
|
|
|
- assertEquals(source.getGroomFather(), target.getGroomFather());
|
|
|
|
|
- assertEquals(source.getGroomFatherRank(), target.getGroomFatherRank());
|
|
|
|
|
- assertEquals(source.getGroomRank(), target.getGroomRank());
|
|
|
|
|
- assertEquals(source.getGroomRank(), target.getGroomRank());
|
|
|
|
|
- assertEquals(source.getGroomUntrackedFather(), target.getGroomUntrackedFather());
|
|
|
|
|
- assertEquals(source.getGroomUntrackedResidence(), target.getGroomUntrackedResidence());
|
|
|
|
|
- assertEquals(source.getGroomUsualResidence(), target.getGroomUsualResidence());
|
|
|
|
|
- assertEquals(source.getId(), target.getId());
|
|
|
|
|
- assertEquals(source.getNumber(), target.getNumber());
|
|
|
|
|
- assertEquals(source.getRegistrationAuthority(), target.getRegistrationAuthority());
|
|
|
|
|
- assertEquals(source.getSecondWitness(), target.getSecondWitness());
|
|
|
|
|
- assertEquals(source.getSecondWitness(), target.getSecondWitness());
|
|
|
|
|
- assertEquals(source.getUntrackedFirstWitness(), target.getUntrackedFirstWitness());
|
|
|
|
|
- assertEquals(source.getUntrackedSecondWitness(), target.getUntrackedSecondWitness());
|
|
|
|
|
- assertEquals(source.getUntrackedWhereMarried(), target.getUntrackedWhereMarried());
|
|
|
|
|
- assertEquals(source.getVolume(), target.getVolume());
|
|
|
|
|
- assertEquals(source.getWhenMarried(), target.getWhenMarried());
|
|
|
|
|
- assertEquals(source.getWhereMarried(), target.getWhereMarried());
|
|
|
|
|
- assertEquals(source.getWhereMarried(), target.getWhereMarried());
|
|
|
|
|
|
|
|
|
|
|
|
+ @BeforeEach
|
|
|
|
|
+ void setUp() {
|
|
|
|
|
+ converter = new MarriageCertificateCommandConverterImpl(
|
|
|
|
|
+ marriageCertificateBrideConverterMock,
|
|
|
|
|
+ marriageCertificateGroomConverterMock,
|
|
|
|
|
+ marriageCertificateWitnessConverterMock,
|
|
|
|
|
+ marriageCertificateCertificateConverterMock);
|
|
|
|
|
+ marriageCertificateCommand = new MarriageCertificateCommandImpl();
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ @Test
|
|
|
|
|
+ void helpersGetCalledTest() {
|
|
|
|
|
+ MarriageCertificate certificate = converter.convert(marriageCertificateCommand);
|
|
|
|
|
+ verify(marriageCertificateBrideConverterMock).convert(marriageCertificateCommand, certificate);
|
|
|
|
|
+ verify(marriageCertificateGroomConverterMock).convert(marriageCertificateCommand, certificate);
|
|
|
|
|
+ verify(marriageCertificateWitnessConverterMock).convert(marriageCertificateCommand, certificate);
|
|
|
|
|
+ verify(marriageCertificateCertificateConverterMock).convert(marriageCertificateCommand, certificate);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|