BackupImapStore extends ImapStore { public static boolean isValidImapFolder(String imapFolder) { return !(imapFolder == null || imapFolder.length() == 0) && !(imapFolder.charAt(0) == '/' || imapFolder.charAt(0) == ' ' || imapFolder.charAt(imapFolder.length() - 1) == ' '); } 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 shouldTestForValidFolder() throws Exception { assertThat(isValidImapFolder(null)).isFalse(); assertThat(isValidImapFolder("")).isFalse(); assertThat(isValidImapFolder("foo")).isTrue(); assertThat(isValidImapFolder("foo bar")).isTrue(); assertThat(isValidImapFolder(" foo")).isFalse(); assertThat(isValidImapFolder("foo ")).isFalse(); assertThat(isValidImapFolder("foo/nested")).isTrue(); assertThat(isValidImapFolder("/foo/nested")).isFalse(); }