Skip to content

Commit

Permalink
fix: Operator test case
Browse files Browse the repository at this point in the history
  • Loading branch information
SaadEGI committed Aug 15, 2023
1 parent ce78b61 commit 9e1cc10
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public List<UiCriterionDto> mapToCriterionDtos(@NonNull List<Criterion> criteria
return criteria.stream().map(this::mapToCriterionDto).toList();
}

public UiCriterionDto mapToCriterionDto(Criterion criterion) {
UiCriterionDto mapToCriterionDto(Criterion criterion) {
if (criterion == null) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
import static org.assertj.core.api.Assertions.assertThat;

import java.util.Arrays;
public class OperatorMapperTest {

class OperatorMapperTest {
OperatorMapper operatorMapper;

@BeforeEach
Expand All @@ -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";
Expand Down

0 comments on commit 9e1cc10

Please sign in to comment.