File tree Expand file tree Collapse file tree
androidTestObjectServer/java/io/realm
objectServer/java/io/realm Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11## 2.2.1
22
3+ ### Object Server API Changes (In Beta)
4+
5+ * Fixed ` SyncConfiguration.toString() ` so it now outputs a correct description instead of an empty string (#3787 ).
6+
37### Bug fixes
48
59* Added version number to the native library, preventing ReLinker from accidentally loading old code (#3775 ).
Original file line number Diff line number Diff line change @@ -391,4 +391,14 @@ public void defaultRxFactory() {
391391
392392 assertNotNull (config .getRxFactory ());
393393 }
394+
395+ @ Test
396+ public void toString_nonEmpty () {
397+ SyncUser user = createTestUser ();
398+ String url = "realm://objectserver.realm.io/default" ;
399+ SyncConfiguration config = new SyncConfiguration .Builder (user , url ).build ();
400+
401+ String configStr = config .toString ();
402+ assertTrue (configStr != null && !configStr .isEmpty ());
403+ }
394404}
Original file line number Diff line number Diff line change @@ -144,4 +144,11 @@ public void getManagementRealm_enforceTLS() throws URISyntaxException {
144144 managementRealm .close ();
145145 }
146146
147+ @ Test
148+ public void toString_returnDescription () {
149+ SyncUser user = SyncTestUtils .createTestUser ("http://objectserver.realm.io/auth" );
150+ String str = user .toString ();
151+ assertTrue (str != null && !str .isEmpty ());
152+ }
153+
147154}
Original file line number Diff line number Diff line change @@ -177,8 +177,17 @@ public int hashCode() {
177177
178178 @ Override
179179 public String toString () {
180- StringBuilder stringBuilder = new StringBuilder ();
181- // TODO
180+ StringBuilder stringBuilder = new StringBuilder (super .toString ());
181+ stringBuilder .append ("\n " );
182+ stringBuilder .append ("serverUrl: " + serverUrl );
183+ stringBuilder .append ("\n " );
184+ stringBuilder .append ("user: " + user );
185+ stringBuilder .append ("\n " );
186+ stringBuilder .append ("syncPolicy: " + syncPolicy );
187+ stringBuilder .append ("\n " );
188+ stringBuilder .append ("errorHandler: " + errorHandler );
189+ stringBuilder .append ("\n " );
190+ stringBuilder .append ("deleteRealmOnLogout: " + deleteRealmOnLogout );
182191 return stringBuilder .toString ();
183192 }
184193
Original file line number Diff line number Diff line change @@ -408,6 +408,17 @@ public int hashCode() {
408408 return syncUser .hashCode ();
409409 }
410410
411+ @ Override
412+ public String toString () {
413+ StringBuilder sb = new StringBuilder ("{" );
414+ sb .append ("UserId: " ).append (syncUser .getIdentity ());
415+ sb .append (", AuthUrl: " ).append (syncUser .getAuthenticationUrl ());
416+ sb .append (", IsValid: " ).append (isValid ());
417+ sb .append (", Sessions: " ).append (syncUser .getSessions ().size ());
418+ sb .append ("}" );
419+ return sb .toString ();
420+ }
421+
411422 // Expose internal representation for other package protected classes
412423 ObjectServerUser getSyncUser () {
413424 return syncUser ;
You can’t perform that action at this time.
0 commit comments