Pull request #13: Use Hint in IntegrationTest

Merge in RED/redaction-service from DEV3 to master

* commit 'b57a4a2db3fb8090004dd5f3babd0d7786312730':
  Use Hint in IntegrationTest
This commit is contained in:
Cheng Zhu 2020-07-24 11:03:58 +02:00
commit d282680cc8

View File

@ -70,6 +70,7 @@ public class RedactionIntegrationTest {
private final Map<String, List<String>> dictionary = new HashMap<>(); private final Map<String, List<String>> dictionary = new HashMap<>();
private final Map<String, float[]> typeColorMap = new HashMap<>(); private final Map<String, float[]> typeColorMap = new HashMap<>();
private final Map<String, Boolean> hintTypeMap = new HashMap<>();
@TestConfiguration @TestConfiguration
public static class RedactionIntegrationTestConfiguration { public static class RedactionIntegrationTestConfiguration {
@ -149,6 +150,12 @@ public class RedactionIntegrationTest {
typeColorMap.put(NAME_CODE, new float[]{1, 1, 0}); typeColorMap.put(NAME_CODE, new float[]{1, 1, 0});
typeColorMap.put(NO_REDACTION_INDICATOR, new float[]{1, 0.502f, 0}); typeColorMap.put(NO_REDACTION_INDICATOR, new float[]{1, 0.502f, 0});
typeColorMap.put(DEFAULT, new float[]{1, 0.502f, 0}); typeColorMap.put(DEFAULT, new float[]{1, 0.502f, 0});
hintTypeMap.put(VERTEBRATES_CODE, true);
hintTypeMap.put(ADDRESS_CODE, false);
hintTypeMap.put(NAME_CODE, false);
hintTypeMap.put(NO_REDACTION_INDICATOR, true);
hintTypeMap.put(DEFAULT, true);
} }
@ -156,14 +163,17 @@ public class RedactionIntegrationTest {
return typeColorMap.entrySet() return typeColorMap.entrySet()
.stream() .stream()
.map(typeColor -> TypeResult.builder().type(typeColor.getKey()).color(typeColor.getValue()).build()) .map(typeColor -> TypeResult.builder()
.type(typeColor.getKey())
.color(typeColor.getValue())
.isHint(hintTypeMap.get(typeColor.getKey())).build())
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
private DictionaryResponse getDictionaryResponse(String type) { private DictionaryResponse getDictionaryResponse(String type) {
return DictionaryResponse.builder().color(typeColorMap.get(type)).entries(dictionary.get(type)).build(); return DictionaryResponse.builder().color(typeColorMap.get(type)).entries(dictionary.get(type)).isHint(hintTypeMap.get(type)).build();
} }