|
@@ -48,19 +48,19 @@ class GatherDeathCertificateDeceasedTimeLineDataWhenNowhereRegisteredTest {
|
|
|
|
|
|
private Person informant;
|
|
private Person informant;
|
|
|
|
|
|
|
|
+ private DeathCertificate deathCertificate;
|
|
|
|
|
|
@BeforeEach
|
|
@BeforeEach
|
|
void setUp() {
|
|
void setUp() {
|
|
gatherDeathCertificateDeceasedTimeLineData = new GatherDeathCertificateDeceasedTimeLineDataImpl(this.timelineDataMock);
|
|
gatherDeathCertificateDeceasedTimeLineData = new GatherDeathCertificateDeceasedTimeLineDataImpl(this.timelineDataMock);
|
|
deathCertificates = new ArrayList<>();
|
|
deathCertificates = new ArrayList<>();
|
|
- DeathCertificate deathCertificate = new DeathCertificate();
|
|
|
|
|
|
+ deathCertificate = new DeathCertificate();
|
|
String registrationAuthorityName = GetRandomString();
|
|
String registrationAuthorityName = GetRandomString();
|
|
registrationAuthority = new Organisation();
|
|
registrationAuthority = new Organisation();
|
|
registrationAuthority.setName(registrationAuthorityName);
|
|
registrationAuthority.setName(registrationAuthorityName);
|
|
deceased = GetRandomPerson();
|
|
deceased = GetRandomPerson();
|
|
informant = GetRandomPerson();
|
|
informant = GetRandomPerson();
|
|
- setUpCertificate(deathCertificate);
|
|
|
|
- deathCertificates.add(deathCertificate);
|
|
|
|
|
|
+
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -74,6 +74,29 @@ class GatherDeathCertificateDeceasedTimeLineDataWhenNowhereRegisteredTest {
|
|
|
|
|
|
@Test
|
|
@Test
|
|
void registeredAtNullTest() {
|
|
void registeredAtNullTest() {
|
|
|
|
+ setUpCertificate(deathCertificate);
|
|
|
|
+ deathCertificates.add(deathCertificate);
|
|
|
|
+ ArgumentCaptor<DMY> dmyCaptor = ArgumentCaptor.forClass(DMY.class);
|
|
|
|
+ //noinspection unchecked
|
|
|
|
+ ArgumentCaptor<List<String>> listCaptor = ArgumentCaptor.forClass(List.class);
|
|
|
|
+ when(timelineDataMock.getTimeLine()).thenReturn(timeLineMock);
|
|
|
|
+ gatherDeathCertificateDeceasedTimeLineData.gather(deathCertificates);
|
|
|
|
+ verify(timeLineMock, atLeast(1)).put(dmyCaptor.capture(), listCaptor.capture());
|
|
|
|
+ String expected = "Death registered by " + informant + " at " + registrationAuthority;
|
|
|
|
+ for (int i = 0; i < listCaptor.getAllValues().size(); i++) {
|
|
|
|
+ if (expected.equals(listCaptor.getAllValues().get(i).get(0))) {
|
|
|
|
+ assertTrue(true);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ fail();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Test
|
|
|
|
+ void registeredAtEmptyTest() {
|
|
|
|
+ setUpCertificate(deathCertificate);
|
|
|
|
+ deathCertificate.setWhereRegistered("");
|
|
|
|
+ deathCertificates.add(deathCertificate);
|
|
ArgumentCaptor<DMY> dmyCaptor = ArgumentCaptor.forClass(DMY.class);
|
|
ArgumentCaptor<DMY> dmyCaptor = ArgumentCaptor.forClass(DMY.class);
|
|
//noinspection unchecked
|
|
//noinspection unchecked
|
|
ArgumentCaptor<List<String>> listCaptor = ArgumentCaptor.forClass(List.class);
|
|
ArgumentCaptor<List<String>> listCaptor = ArgumentCaptor.forClass(List.class);
|