Skip to content

Commit de1528f

Browse files
committed
fix: Remove codelist heuristic, add measure/duration test (TEDEFO-5013)
1 parent 27dcb6d commit de1528f

3 files changed

Lines changed: 14 additions & 10 deletions

File tree

src/main/java/eu/europa/ted/eforms/sdk/SdkSymbolResolver.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -305,16 +305,6 @@ public String getTypeOfField(String fieldId) {
305305
throw SymbolResolutionException.unknownSymbol(fieldId);
306306
}
307307

308-
// Temporary: the SDK does not yet distinguish duration from measure.
309-
// Both are "measure" in the SDK, but durations use the "duration-unit" codelist.
310-
// Remove this when the SDK adds "duration" as a proper data type.
311-
if (FieldTypes.MEASURE.getName().equals(sdkField.getType())) {
312-
SdkField unitCodeField = sdkField.getAttributeField("unitCode");
313-
if (unitCodeField != null && "duration-unit".equals(unitCodeField.getCodelistId())) {
314-
return FieldTypes.DURATION.getName();
315-
}
316-
}
317-
318308
return sdkField.getType();
319309
}
320310

src/test/java/eu/europa/ted/efx/sdk1/EfxExpressionTranslatorV1Test.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,13 @@ void testFieldValueComparison_TypeMismatch() {
161161
() -> translateExpressionWithContext("ND-Root", "00:01:00 > BT-00-StartDate"));
162162
}
163163

164+
// TEDEFO-5013: In SDK 1.x "measure" is the duration type (SDK 2.x introduced "duration").
165+
// A measure field compared with a duration literal should translate successfully.
166+
@Test
167+
void testDurationComparison_WithMeasureField_TEDEFO5013() {
168+
translateExpressionWithContext("ND-Root", "BT-00-Measure > P7Y");
169+
}
170+
164171

165172
@Test
166173
void testBooleanComparison_UsingLiterals() {

src/test/resources/json/sdk1-fields.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,13 @@
121121
"xpathAbsolute": "/*/PathNode/DurationField",
122122
"xpathRelative": "PathNode/DurationField"
123123
},
124+
{
125+
"id": "BT-00-Measure",
126+
"type": "measure",
127+
"parentNodeId": "ND-Root",
128+
"xpathAbsolute": "/*/PathNode/MeasureField",
129+
"xpathRelative": "PathNode/MeasureField"
130+
},
124131
{
125132
"id": "BT-00-Integer",
126133
"type": "integer",

0 commit comments

Comments
 (0)