5656import com .microsoft .azure .documentdb .User ;
5757import com .microsoft .azure .documentdb .UserDefinedFunction ;
5858
59+ final class AnotherPOJO {
60+ public String pojoProp = "789" ;
61+ }
62+
5963public final class GatewayTests {
6064 static final String HOST = "[YOUR_ENDPOINT_HERE]" ;
6165 static final String MASTER_KEY = "[YOUR_KEY_HERE]" ;
@@ -193,7 +197,7 @@ private static String getStringFromInputStream(InputStream is) {
193197 }
194198
195199 static class StaticPOJOForTest {
196- // Jackson's readValue method only supports static and non-local POJO .
200+ // Jackson's readValue method supports member class only if it's static .
197201 public String pojoProp = "456" ;
198202 }
199203
@@ -207,6 +211,7 @@ public void testJsonSerialization() {
207211 document .set ("child2" , new JSONObject ("{'child2Prop1': '800'}" ));
208212
209213 document .set ("child3" , new StaticPOJOForTest ());
214+ document .set ("child4" , new AnotherPOJO ());
210215 // Collection of numbers.
211216 Collection <Integer > collection1 = new ArrayList <Integer >();
212217 collection1 .add (101 );
@@ -242,6 +247,9 @@ public void testJsonSerialization() {
242247 " 'child3': {" +
243248 " 'pojoProp': '456'" +
244249 " }," +
250+ " 'child4': {" +
251+ " 'pojoProp': '789'" +
252+ " }," +
245253 " 'collection1': [101, 102]," +
246254 " 'collection2': [{'foo': 'bar'}]," +
247255 " 'collection3': [{'pojoProp': '456'}]," +
@@ -250,6 +258,7 @@ public void testJsonSerialization() {
250258 Assert .assertEquals (expectedDocument .toString (), document .toString ());
251259
252260 Assert .assertEquals ("456" , document .getObject ("child3" , StaticPOJOForTest .class ).pojoProp );
261+ Assert .assertEquals ("789" , document .getObject ("child4" , AnotherPOJO .class ).pojoProp );
253262 Assert .assertEquals ("456" , document .getCollection ("collection3" ,
254263 StaticPOJOForTest .class ).iterator ().next ().pojoProp );
255264
@@ -1242,7 +1251,7 @@ public void testOfferReadAndQuery() throws DocumentClientException {
12421251
12431252 // Modify the SelfLink
12441253 String offerLink = expectedOffer .getSelfLink ().substring (
1245- 0 , expectedOffer .getSelfLink ().length () - 1 ) + "x" ;
1254+ 0 , expectedOffer .getSelfLink ().length () - 1 ) + "x" ;
12461255
12471256 // Read the offer
12481257 try {
0 commit comments