RED-7384: migration fixes

* fix test
This commit is contained in:
Kilian Schuettler 2024-04-05 13:27:36 +02:00
parent 7df02d588a
commit 5bfeec1b21

View File

@ -243,14 +243,13 @@ public class EntityLogMergeTest {
String dossierId = "dossierId";
String dossierTemplateId = "dossierTemplateId";
String entryToAddId = UUID.randomUUID().toString();
String rectangleToAddId = UUID.randomUUID().toString();
String entryToRemoveId = UUID.randomUUID().toString();
String entryToResizeId = UUID.randomUUID().toString();
String entryLegalBasisId = UUID.randomUUID().toString();
String forceRedactionId = UUID.randomUUID().toString();
ManualRedactions manualRedactions = provideManualRedactions(entryToAddId, entryToRemoveId, entryToResizeId, entryLegalBasisId, forceRedactionId, fileId, rectangleToAddId);
ManualRedactions manualRedactions = provideManualRedactions(entryLegalBasisId, entryToRemoveId, entryToResizeId, entryLegalBasisId, forceRedactionId, fileId, rectangleToAddId);
var entityLog = provideEntityLog(entryToRemoveId, entryToResizeId, entryLegalBasisId, forceRedactionId, true);
@ -272,21 +271,22 @@ public class EntityLogMergeTest {
.filter(entityLogEntry1 -> entityLogEntry1.getId().equals(entryToResizeId))
.findFirst();
assertTrue(optionalResizeEntryLogEntry.isPresent());
assertEquals(optionalResizeEntryLogEntry.get().getEntryType(), EntryType.ENTITY);
assertEquals(EntryType.ENTITY, optionalResizeEntryLogEntry.get().getEntryType());
var optionalLegalBasisEntryLogEntry = response.getEntityLogEntry()
var legalBasisEntries = response.getEntityLogEntry()
.stream()
.filter(entityLogEntry1 -> entityLogEntry1.getId().equals(entryLegalBasisId))
.findFirst();
assertTrue(optionalLegalBasisEntryLogEntry.isPresent());
assertEquals(optionalLegalBasisEntryLogEntry.get().getState(), EntryState.REMOVED);
.toList();
assertEquals(2, legalBasisEntries.size());
assertEquals(EntryState.REMOVED, legalBasisEntries.get(0).getState());
assertEquals(EntryState.APPLIED, legalBasisEntries.get(1).getState());
var optionalForceRedactionEntryLogEntry = response.getEntityLogEntry()
.stream()
.filter(entityLogEntry1 -> entityLogEntry1.getId().equals(forceRedactionId))
.findFirst();
assertTrue(optionalForceRedactionEntryLogEntry.isPresent());
assertEquals(optionalForceRedactionEntryLogEntry.get().getState(), EntryState.REMOVED);
assertEquals(EntryState.APPLIED, optionalForceRedactionEntryLogEntry.get().getState());
}
@ -302,7 +302,6 @@ public class EntityLogMergeTest {
String entryLegalBasisId = UUID.randomUUID().toString();
String forceRedactionId = UUID.randomUUID().toString();
ManualRedactions manualRedactions = new ManualRedactions();
List<Rectangle> positions = new ArrayList<>();
positions.add(new Rectangle(2, 2, 2, 2, 1));
@ -329,10 +328,16 @@ public class EntityLogMergeTest {
EntityLog response = entityLogMergeService.mergeEntityLog(manualRedactions, entityLog, DossierEntity.builder().dossierTemplateId(dossierTemplateId).build());
var resizedEntry = response.getEntityLogEntry().stream().filter(entityLogEntry1 -> entityLogEntry1.getId().equals(entryToResizeId)).findFirst().get();
var resizedEntry = response.getEntityLogEntry()
.stream()
.filter(entityLogEntry1 -> entityLogEntry1.getId().equals(entryToResizeId))
.findFirst()
.get();
int index = response.getEntityLogEntry().indexOf(resizedEntry);
assertEquals(response.getEntityLogEntry().get(index + 1).getId(), resizedEntry.getId());
assertEquals(response.getEntityLogEntry().get(index + 1).getState(), EntryState.PENDING);
assertEquals(response.getEntityLogEntry()
.get(index + 1).getId(), resizedEntry.getId());
assertEquals(response.getEntityLogEntry()
.get(index + 1).getState(), EntryState.PENDING);
}