@Test public void getImportStreamContents_alternativeName() throws SettingsImportExportException { String validUUID = UUID.randomUUID().toString(); InputStream inputStream = new StringInputStream("<k9settings format=\"1\" version=\"1\">" + "<accounts>" + "<account uuid=\"" + validUUID + "\">" + "<name></name>" + "<identities>" + "<identity>" + "<email>user@gmail.com</email>" + "</identity>" + "</identities>" + "</account>" + "</accounts></k9settings>"); SettingsImporter.ImportContents results = SettingsImporter.getImportStreamContents(inputStream); assertEquals(false, results.globalSettings); assertEquals(1, results.accounts.size()); assertEquals("user@gmail.com", results.accounts.get(0).name); assertEquals(validUUID, results.accounts.get(0).uuid); }
public static ImportContents getImportStreamContents(InputStream inputStream) throws SettingsImportExportException { try { Imported imported = parseSettings(inputStream, false, null, true); boolean globalSettings = (imported.globalSettings != null); final List<AccountDescription> accounts = new ArrayList<>(); if (imported.accounts != null) { for (ImportedAccount account : imported.accounts.values()) { String accountName = getAccountDisplayName(account); accounts.add(new AccountDescription(accountName, account.uuid)); } } return new ImportContents(globalSettings, accounts); } catch (SettingsImportExportException e) { throw e; } catch (Exception e) { throw new SettingsImportExportException(e); } }
SettingsImporter { public static ImportContents getImportStreamContents(InputStream inputStream) throws SettingsImportExportException { try { Imported imported = parseSettings(inputStream, false, null, true); boolean globalSettings = (imported.globalSettings != null); final List<AccountDescription> accounts = new ArrayList<>(); if (imported.accounts != null) { for (ImportedAccount account : imported.accounts.values()) { String accountName = getAccountDisplayName(account); accounts.add(new AccountDescription(accountName, account.uuid)); } } return new ImportContents(globalSettings, accounts); } catch (SettingsImportExportException e) { throw e; } catch (Exception e) { throw new SettingsImportExportException(e); } } }
SettingsImporter { public static ImportContents getImportStreamContents(InputStream inputStream) throws SettingsImportExportException { try { Imported imported = parseSettings(inputStream, false, null, true); boolean globalSettings = (imported.globalSettings != null); final List<AccountDescription> accounts = new ArrayList<>(); if (imported.accounts != null) { for (ImportedAccount account : imported.accounts.values()) { String accountName = getAccountDisplayName(account); accounts.add(new AccountDescription(accountName, account.uuid)); } } return new ImportContents(globalSettings, accounts); } catch (SettingsImportExportException e) { throw e; } catch (Exception e) { throw new SettingsImportExportException(e); } }  }
SettingsImporter { public static ImportContents getImportStreamContents(InputStream inputStream) throws SettingsImportExportException { try { Imported imported = parseSettings(inputStream, false, null, true); boolean globalSettings = (imported.globalSettings != null); final List<AccountDescription> accounts = new ArrayList<>(); if (imported.accounts != null) { for (ImportedAccount account : imported.accounts.values()) { String accountName = getAccountDisplayName(account); accounts.add(new AccountDescription(accountName, account.uuid)); } } return new ImportContents(globalSettings, accounts); } catch (SettingsImportExportException e) { throw e; } catch (Exception e) { throw new SettingsImportExportException(e); } }  static ImportContents getImportStreamContents(InputStream inputStream); static ImportResults importSettings(Context context, InputStream inputStream, boolean globalSettings,
            List<String> accountUuids, boolean overwrite); }
SettingsImporter { public static ImportContents getImportStreamContents(InputStream inputStream) throws SettingsImportExportException { try { Imported imported = parseSettings(inputStream, false, null, true); boolean globalSettings = (imported.globalSettings != null); final List<AccountDescription> accounts = new ArrayList<>(); if (imported.accounts != null) { for (ImportedAccount account : imported.accounts.values()) { String accountName = getAccountDisplayName(account); accounts.add(new AccountDescription(accountName, account.uuid)); } } return new ImportContents(globalSettings, accounts); } catch (SettingsImportExportException e) { throw e; } catch (Exception e) { throw new SettingsImportExportException(e); } }  static ImportContents getImportStreamContents(InputStream inputStream); static ImportResults importSettings(Context context, InputStream inputStream, boolean globalSettings,
            List<String> accountUuids, boolean overwrite);  }