18
18
import static org .junit .Assert .assertEquals ;
19
19
import static org .junit .Assert .assertTrue ;
20
20
21
+ import com .google .common .collect .ImmutableMap ;
21
22
import org .junit .Test ;
22
23
23
24
public class RangeTest {
@@ -77,6 +78,17 @@ public void testToBuilder() {
77
78
compareRange (RANGE_TIMESTAMP , RANGE_TIMESTAMP .toBuilder ().build ());
78
79
}
79
80
81
+ @ Test
82
+ public void testGetValues () {
83
+ compareRange (null , null , Range .of ("[null, NULL)" ).getValues ());
84
+ compareRange (null , null , Range .of ("[unbounded, UNBOUNDED)" ).getValues ());
85
+ compareRange (null , null , Range .of ("[nUlL, uNbOuNdEd)" ).getValues ());
86
+
87
+ compareRange (null , "2020-12-31" , Range .of ("[null, 2020-12-31)" ).getValues ());
88
+ compareRange ("2020-01-01" , null , Range .of ("[2020-01-01, null)" ).getValues ());
89
+ compareRange ("2020-01-01" , "2020-12-31" , Range .of ("[2020-01-01, 2020-12-31)" ).getValues ());
90
+ }
91
+
80
92
private static void compareRange (Range expected , Range value ) {
81
93
assertEquals (expected .getStart (), value .getStart ());
82
94
assertEquals (expected .getEnd (), value .getEnd ());
@@ -97,4 +109,10 @@ private static void compareRange(String expectedStart, String expectedEnd, Range
97
109
assertEquals (expectedEnd , range .getEnd ().getStringValue ());
98
110
}
99
111
}
112
+
113
+ private static void compareRange (
114
+ String expectedStart , String expectedEnd , ImmutableMap <String , String > values ) {
115
+ assertEquals (expectedStart , values .get ("start" ));
116
+ assertEquals (expectedEnd , values .get ("end" ));
117
+ }
100
118
}
0 commit comments