25
25
26
26
@ ExtendWith (MockitoExtension .class )
27
27
class AnnotatedAttributeGroupTest {
28
+
28
29
static final LocalDate DATE_START = LocalDate .parse ("2023-01-01" );
29
30
static final LocalDate DATE_END = LocalDate .parse ("2023-12-31" );
30
31
static final Code CODE1 = new Code ("system1" , "code1" );
@@ -40,12 +41,12 @@ class Queries {
40
41
void oneCode () {
41
42
when (mappingTreeBase .expand ("system1" , "code1" )).thenReturn (Stream .of ("code1" ));
42
43
var tokenFilter = new Filter ("token" , "code" , List .of (CODE1 ));
43
- var attributeGroup = new AnnotatedAttributeGroup ("test" , "Observation" , "groupRef" , List .of (new AnnotatedAttribute ( "Observation.name" , "Observation.name" , "Observation.name" , false ) ), List .of (tokenFilter ), null );
44
+ var attributeGroup = new AnnotatedAttributeGroup ("test" , "Observation" , "groupRef" , List .of (), List .of (tokenFilter ), null );
44
45
45
46
var result = attributeGroup .queries (mappingTreeBase , "Observation" );
46
47
47
48
assertThat (result ).containsExactly (
48
- new Query ("Observation" , QueryParams .of ("code" , codeValue (CODE1 )).appendParam ("_profile:below" , stringValue ("groupRef" )))
49
+ Query . of ("Observation" , QueryParams .of ("code" , codeValue (CODE1 )).appendParam ("_profile:below" , stringValue ("groupRef" )))
49
50
);
50
51
}
51
52
@@ -54,32 +55,32 @@ void twoCodes() {
54
55
when (mappingTreeBase .expand ("system1" , "code1" )).thenReturn (Stream .of ("code1" ));
55
56
when (mappingTreeBase .expand ("system2" , "code2" )).thenReturn (Stream .of ("code2" ));
56
57
var tokenFilter = new Filter ("token" , "code" , List .of (CODE1 , CODE2 ));
57
- var attributeGroup = new AnnotatedAttributeGroup ("test" , "Observation" , "groupRef" , List .of (new AnnotatedAttribute ( "Observation.name" , "Observation.name" , "Observation.name" , false ) ), List .of (tokenFilter ), null );
58
+ var attributeGroup = new AnnotatedAttributeGroup ("test" , "Observation" , "groupRef" , List .of (), List .of (tokenFilter ), null );
58
59
59
60
var result = attributeGroup .queries (mappingTreeBase , "Observation" );
60
61
61
62
assertThat (result ).containsExactly (
62
- new Query ("Observation" , QueryParams .of ("code" , codeValue (CODE1 )).appendParam ("_profile:below" , stringValue ("groupRef" ))),
63
- new Query ("Observation" , QueryParams .of ("code" , codeValue (CODE2 )).appendParam ("_profile:below" , stringValue ("groupRef" )))
63
+ Query . of ("Observation" , QueryParams .of ("code" , codeValue (CODE1 )).appendParam ("_profile:below" , stringValue ("groupRef" ))),
64
+ Query . of ("Observation" , QueryParams .of ("code" , codeValue (CODE2 )).appendParam ("_profile:below" , stringValue ("groupRef" )))
64
65
);
65
66
}
66
67
67
68
@ Test
68
69
void dateFilter () {
69
70
var dateFilter = new Filter ("date" , "date" , DATE_START , DATE_END );
70
- var attributeGroup = new AnnotatedAttributeGroup ("test" , "Observation" , "groupRef" , List .of (new AnnotatedAttribute ( "Observation.name" , "Observation.name" , "Observation.name" , false ) ), List .of (dateFilter ), null );
71
+ var attributeGroup = new AnnotatedAttributeGroup ("test" , "Observation" , "groupRef" , List .of (), List .of (dateFilter ), null );
71
72
72
73
var result = attributeGroup .queries (mappingTreeBase , "Observation" );
73
74
74
75
assertThat (result ).containsExactly (
75
- new Query ("Observation" , QueryParams .of ("date" , dateValue (GREATER_EQUAL , DATE_START )).appendParam ("date" , dateValue (LESS_EQUAL , DATE_END )).appendParam ("_profile:below" , stringValue ("groupRef" )))
76
+ Query . of ("Observation" , QueryParams .of ("date" , dateValue (GREATER_EQUAL , DATE_START )).appendParam ("date" , dateValue (LESS_EQUAL , DATE_END )).appendParam ("_profile:below" , stringValue ("groupRef" )))
76
77
);
77
78
}
78
79
79
80
@ Test
80
81
void filtersIgnoredForPatient () {
81
82
var dateFilter = new Filter ("date" , "date" , DATE_START , DATE_END );
82
- var attributeGroup = new AnnotatedAttributeGroup ("test" , "Observation" , "groupRef" , List .of (new AnnotatedAttribute ( "Patient.name" , "Patient.name" , "Patient.name" , false ) ), List .of (dateFilter ), null );
83
+ var attributeGroup = new AnnotatedAttributeGroup ("test" , "Observation" , "groupRef" , List .of (), List .of (dateFilter ), null );
83
84
84
85
var result = attributeGroup .queries (mappingTreeBase , "Patient" );
85
86
0 commit comments