1
1
/*
2
- * Copyright 2014-2015 the original author or authors.
2
+ * Copyright 2014-2016 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
20
20
21
21
import java .beans .PropertyDescriptor ;
22
22
import java .lang .reflect .Proxy ;
23
+ import java .util .Collections ;
23
24
import java .util .HashMap ;
24
25
import java .util .List ;
25
26
import java .util .Map ;
@@ -159,7 +160,7 @@ public void returnsAllPropertiesAsInputProperties() {
159
160
ProjectionInformation projectionInformation = factory .getProjectionInformation (CustomerExcerpt .class );
160
161
List <PropertyDescriptor > result = projectionInformation .getInputProperties ();
161
162
162
- assertThat (result , hasSize (5 ));
163
+ assertThat (result , hasSize (6 ));
163
164
}
164
165
165
166
/**
@@ -247,13 +248,30 @@ public void exposesProjectionInformationCorrectly() {
247
248
assertThat (information .isClosed (), is (true ));
248
249
}
249
250
251
+ /**
252
+ * @see DATACMNS-829
253
+ */
254
+ @ Test
255
+ public void projectsMapOfStringToObjectCorrectly () {
256
+
257
+ Customer customer = new Customer ();
258
+ customer .data = Collections .singletonMap ("key" , null );
259
+
260
+ Map <String , Object > data = factory .createProjection (CustomerExcerpt .class , customer ).getData ();
261
+
262
+ assertThat (data , is (notNullValue ()));
263
+ assertThat (data .containsKey ("key" ), is (true ));
264
+ assertThat (data .get ("key" ), is (nullValue ()));
265
+ }
266
+
250
267
static class Customer {
251
268
252
269
public Long id ;
253
270
public String firstname , lastname ;
254
271
public Address address ;
255
272
public byte [] picture ;
256
273
public Address [] shippingAddresses ;
274
+ public Map <String , Object > data ;
257
275
}
258
276
259
277
static class Address {
@@ -272,6 +290,8 @@ interface CustomerExcerpt {
272
290
AddressExcerpt [] getShippingAddresses ();
273
291
274
292
byte [] getPicture ();
293
+
294
+ Map <String , Object > getData ();
275
295
}
276
296
277
297
interface AddressExcerpt {
0 commit comments