@@ -35,6 +35,7 @@ public class BaseEntityTest {
35
35
36
36
private static final Blob BLOB = Blob .copyFrom (new byte []{1 , 2 });
37
37
private static final DateTime DATE_TIME = DateTime .now ();
38
+ private static final LatLng LAT_LNG = new LatLng (37.422035 , -122.084124 );
38
39
private static final Key KEY = Key .builder ("ds1" , "k1" , "n1" ).build ();
39
40
private static final Entity ENTITY = Entity .builder (KEY ).set ("name" , "foo" ).build ();
40
41
private static final IncompleteKey INCOMPLETE_KEY = IncompleteKey .builder ("ds1" , "k1" ).build ();
@@ -62,9 +63,9 @@ public void setUp() {
62
63
builder = new Builder ();
63
64
builder .set ("blob" , BLOB ).set ("boolean" , true ).set ("dateTime" , DATE_TIME );
64
65
builder .set ("double" , 1.25 ).set ("key" , KEY ).set ("string" , "hello world" );
65
- builder .set ("long" , 125 ).setNull ("null" ).set ("entity" , ENTITY );
66
+ builder .set ("long" , 125 ).setNull ("null" ).set ("entity" , ENTITY ). set ( "latLng" , LAT_LNG ) ;
66
67
builder .set ("partialEntity" , PARTIAL_ENTITY ).set ("stringValue" , StringValue .of ("bla" ));
67
- builder .set ("list1" , NullValue .of (), StringValue .of ("foo" ));
68
+ builder .set ("list1" , NullValue .of (), StringValue .of ("foo" ), LatLngValue . of ( LAT_LNG ) );
68
69
builder .set ("list2" , ImmutableList .of (LongValue .of (10 ), DoubleValue .of (2 )));
69
70
builder .set ("list3" , Collections .singletonList (BooleanValue .of (true )));
70
71
}
@@ -149,6 +150,12 @@ public void testGetDateTime() throws Exception {
149
150
assertEquals (dateTime , entity .getDateTime ("dateTime" ));
150
151
}
151
152
153
+ @ Test
154
+ public void testGetLatLng () throws Exception {
155
+ BaseEntity <Key > entity = builder .build ();
156
+ assertEquals (LAT_LNG , entity .getLatLng ("latLng" ));
157
+ }
158
+
152
159
@ Test
153
160
public void testGetKey () throws Exception {
154
161
BaseEntity <Key > entity = builder .build ();
@@ -171,9 +178,10 @@ public void testGetEntity() throws Exception {
171
178
public void testGetList () throws Exception {
172
179
BaseEntity <Key > entity = builder .build ();
173
180
List <? extends Value <?>> list = entity .getList ("list1" );
174
- assertEquals (2 , list .size ());
181
+ assertEquals (3 , list .size ());
175
182
assertEquals (NullValue .of (), list .get (0 ));
176
183
assertEquals ("foo" , list .get (1 ).get ());
184
+ assertEquals (LAT_LNG , list .get (2 ).get ());
177
185
list = entity .getList ("list2" );
178
186
assertEquals (2 , list .size ());
179
187
assertEquals (Long .valueOf (10 ), list .get (0 ).get ());
@@ -196,9 +204,10 @@ public void testGetBlob() throws Exception {
196
204
197
205
@ Test
198
206
public void testNames () throws Exception {
199
- Set <String > names = ImmutableSet .<String >builder ()
200
- .add ("string" , "stringValue" , "boolean" , "double" , "long" , "list1" , "list2" , "list3" )
201
- .add ("entity" , "partialEntity" , "null" , "dateTime" , "blob" , "key" )
207
+ Set <String > names =
208
+ ImmutableSet .<String >builder ()
209
+ .add ("string" , "stringValue" , "boolean" , "double" , "long" , "list1" , "list2" , "list3" )
210
+ .add ("entity" , "partialEntity" , "null" , "dateTime" , "latLng" , "blob" , "key" )
202
211
.build ();
203
212
BaseEntity <Key > entity = builder .build ();
204
213
assertEquals (names , entity .names ());
0 commit comments