From 9e1cc10ab8200026754e3b505aadc059b78b35d0 Mon Sep 17 00:00:00 2001 From: SaadBendou Date: Tue, 15 Aug 2023 16:40:46 +0200 Subject: [PATCH] fix: Operator test case --- .../contracts/services/utils/CriterionMapper.java | 2 +- .../services/utils/OperatorMapperTest.java | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/pages/contracts/services/utils/CriterionMapper.java b/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/pages/contracts/services/utils/CriterionMapper.java index a3bef1c9a..94ee8ba49 100644 --- a/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/pages/contracts/services/utils/CriterionMapper.java +++ b/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/pages/contracts/services/utils/CriterionMapper.java @@ -32,7 +32,7 @@ public List mapToCriterionDtos(@NonNull List criteria return criteria.stream().map(this::mapToCriterionDto).toList(); } - public UiCriterionDto mapToCriterionDto(Criterion criterion) { + UiCriterionDto mapToCriterionDto(Criterion criterion) { if (criterion == null) { return null; } diff --git a/extensions/wrapper/wrapper/src/test/java/de/sovity/edc/ext/wrapper/api/ui/pages/contracts/services/utils/OperatorMapperTest.java b/extensions/wrapper/wrapper/src/test/java/de/sovity/edc/ext/wrapper/api/ui/pages/contracts/services/utils/OperatorMapperTest.java index 9376a97d1..c8a6d92e5 100644 --- a/extensions/wrapper/wrapper/src/test/java/de/sovity/edc/ext/wrapper/api/ui/pages/contracts/services/utils/OperatorMapperTest.java +++ b/extensions/wrapper/wrapper/src/test/java/de/sovity/edc/ext/wrapper/api/ui/pages/contracts/services/utils/OperatorMapperTest.java @@ -8,7 +8,8 @@ import static org.assertj.core.api.Assertions.assertThat; import java.util.Arrays; -public class OperatorMapperTest { + +class OperatorMapperTest { OperatorMapper operatorMapper; @BeforeEach @@ -17,13 +18,21 @@ void setup() { } @Test - void MappingFromDtoToOperator() { + void testMappingFromDtoToOperator() { Arrays.stream(OperatorDto.values()).forEach(dto -> { Operator operator = operatorMapper.toOperator(dto); assertThat(operator.name()).isEqualTo(dto.name()); }); } + @Test + void testMappingFromString() { + Arrays.stream(Operator.values()).forEach(op -> { + var dto = operatorMapper.fromString(op.name()); + assertThat(op.name()).isEqualTo(dto.name()); + }); + } + @Test void testCaseInsensitivityFromString() { String operatorString = "Eq";