RED-6912 - Entries not sorted correctly in the dossier dictionary #16
@ -258,16 +258,18 @@ public class DictionaryService {
|
||||
DictionaryEntry.class));
|
||||
|
||||
return Dictionary.builder()
|
||||
.entries(dictionaryForType.getEntries().stream().filter(e -> !e.isDeleted()).map(DictionaryEntry::getValue).collect(Collectors.toList()))
|
||||
.entries(dictionaryForType.getEntries().stream().filter(e -> !e.isDeleted()).map(DictionaryEntry::getValue).sorted().collect(Collectors.toList()))
|
||||
.falsePositiveEntries(dictionaryForType.getFalsePositiveEntries()
|
||||
.stream()
|
||||
.filter(e -> !e.isDeleted())
|
||||
.map(DictionaryEntry::getValue)
|
||||
.sorted()
|
||||
.collect(Collectors.toList()))
|
||||
.falseRecommendationEntries(dictionaryForType.getFalseRecommendationEntries()
|
||||
.stream()
|
||||
.filter(e -> !e.isDeleted())
|
||||
.map(DictionaryEntry::getValue)
|
||||
.sorted()
|
||||
.collect(Collectors.toList()))
|
||||
.hexColor(dictionaryForType.getHexColor())
|
||||
.recommendationHexColor(dictionaryForType.getRecommendationHexColor())
|
||||
|
||||
@ -412,6 +412,39 @@ public class DictionaryTest extends AbstractPersistenceServerServiceTest {
|
||||
assertThat(dict.getEntries().size()).isEqualTo(4);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSortedEntries() {
|
||||
|
||||
var dossierTemplate = dossierTemplateTesterAndProvider.provideTestTemplate();
|
||||
var dossier = dossierTesterAndProvider.provideTestDossier(dossierTemplate, "Dossier");
|
||||
var type = typeProvider.testAndProvideType(dossierTemplate);
|
||||
assertThat(type.getRecommendationHexColor()).isEqualTo("#aaaaaa");
|
||||
assertThat(type.getSkippedHexColor()).isEqualTo("#aaaaaa");
|
||||
assertThat(type.isDossierDictionaryOnly()).isTrue();
|
||||
|
||||
dictionaryClient.addEntry(type.getType(), type.getDossierTemplateId(), List.of("word1", "anotherone", "morewords"), false, null, DictionaryEntryType.ENTRY);
|
||||
dictionaryClient.addEntry(type.getType(), type.getDossierTemplateId(), List.of("false_positive1", "false_positive"), false, null, DictionaryEntryType.FALSE_POSITIVE);
|
||||
dictionaryClient.addEntry(type.getType(),
|
||||
type.getDossierTemplateId(),
|
||||
List.of("false_recommendation1", "afalse_recommendation2"),
|
||||
false,
|
||||
null,
|
||||
DictionaryEntryType.FALSE_RECOMMENDATION);
|
||||
|
||||
var loadedType1 = dictionaryClient.getDictionaryForType(type.getType(), type.getDossierTemplateId(), null);
|
||||
|
||||
var entries = loadedType1.getEntries();
|
||||
assertThat(entries).hasSize(3);
|
||||
assertThat(entries.get(0)).isEqualTo("anotherone");
|
||||
assertThat(entries.get(1)).isEqualTo("morewords");
|
||||
assertThat(entries.get(2)).isEqualTo("word1");
|
||||
assertThat(loadedType1.getFalsePositiveEntries()).hasSize(2);
|
||||
assertThat(loadedType1.getFalsePositiveEntries().get(0)).isEqualTo("false_positive");
|
||||
assertThat(loadedType1.getFalsePositiveEntries().get(1)).isEqualTo("false_positive1");
|
||||
assertThat(loadedType1.getFalseRecommendationEntries()).hasSize(2);
|
||||
assertThat(loadedType1.getFalseRecommendationEntries().get(0)).isEqualTo("afalse_recommendation2");
|
||||
assertThat(loadedType1.getFalseRecommendationEntries().get(1)).isEqualTo("false_recommendation1");
|
||||
}
|
||||
@Test
|
||||
public void testCreateAndDeleteLargeDictionary() {
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user