Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,12 @@ public MetadataField extractField(MetadataFieldPath path) {
.name("Classification")
.label("Default record classification")
.build();
default -> throw new IllegalArgumentException("Path not supported in definition context: " + path);
// CaseLink metadata
case SOURCE_FIELD_PATH -> MetadataField.builder()
.id(path.toString())
.name("Link source field")
.label("Path of the field from which the link originated")
.build();
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ void shouldReturnEmptySetWhenAllValid() {
var condition = new Condition(
new Criteria[][]{
new Criteria[]{
Criteria.builder().path("complex1").build()
Criteria.builder().path("complex1").build(),
Criteria.builder().path("[sourceFieldPath]").build()
},
new Criteria[]{
Criteria.builder().path("complex1.member1").build(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,19 +143,19 @@ void shouldReturnLastModifiedAtField() {
));
}

@ParameterizedTest
@ValueSource(strings = {
"[sourceFieldPath]"
})
@DisplayName("should throw error for paths not supported in definition context")
void shouldThrowErrorForPathsNotSupported(String path) {
@Test
@DisplayName("should return sourceFieldPath field")
void shouldReturnSourceFieldPathField() {
var extractor = new DefinitionExtractor(recordType());
var error = assertThrows(
IllegalArgumentException.class,
() -> extractor.extractField(FieldPath.ofMetadata(path))
);
var field = extractor.extractField(FieldPath.ofMetadata("[sourceFieldPath]"));

assertThat(error.getMessage(), equalTo("Path not supported in definition context: " + path));
assertThat(field, equalTo(
MetadataField.builder()
.id("[sourceFieldPath]")
.name("Link source field")
.label("Path of the field from which the link originated")
.build()
));
}
}

Expand Down