BackupImapStore extends ImapStore { public String getStoreUriForLogging() { Uri uri = Uri.parse(mStoreConfig.getStoreUri()); String userInfo = uri.getUserInfo(); if (!TextUtils.isEmpty(userInfo) && userInfo.contains(":")) { String[] parts = userInfo.split(":", 2); userInfo = parts[0]+":"+(parts[1].replaceAll(".", "X")); String host = uri.getHost(); if (uri.getPort() != -1) { host += ":"+uri.getPort(); } return uri.buildUpon().encodedAuthority(userInfo + "@" + host).toString(); } else { return uri.toString(); } } BackupImapStore(final Context context, final String uri,
                           boolean trustAllCertificates); BackupFolder getFolder(DataType type, DataTypePreferences preferences); void closeFolders(); @Override String toString(); String getStoreUriForLogging(); String getStoreUri(); static boolean isValidImapFolder(String imapFolder); static boolean isValidUri(String uri);  }
@Test public void shouldHaveToStringWithObfuscatedStoreURI() throws Exception { BackupImapStore store = new BackupImapStore(RuntimeEnvironment.application, "imap: assertThat(store.getStoreUriForLogging()).isEqualTo("imap: }
@Test public void shouldHaveToStringWithObfuscatedStoreURIWithPort() throws Exception { BackupImapStore store = new BackupImapStore(RuntimeEnvironment.application, "imap: assertThat(store.getStoreUriForLogging()).isEqualTo("imap: }