Deck implements Parcelable { public Map<String, Boolean> getAudioFilePaths() { HashMap<String, Boolean> audioFilesMap = new HashMap<>(); for (Dictionary dictionary : dictionaries) { audioFilesMap.putAll(dictionary.getAudioPaths()); } return audioFilesMap; } Deck(String title, String author, String externalId, long dbId, long timestamp,
                boolean locked, String sourceLanguage, Dictionary[] dictionaries);  Deck(String title, String author, String externalId, long timestamp, boolean locked,
                String sourceLanguage);  Deck(); protected  Deck(Parcel in); String getTitle(); String getAuthor(); String getExternalId(); long getDbId(); long getTimestamp(); String getCreationDateString(); String getDeckInformation(); boolean isLocked(); String getSourceLanguageIso(); String getSourceLanguageName(); String getDestinationLanguagesForDisplay(); void setTitle(String title); void setSourceLanguage(String language); void setAuthor(String author); JSONObject toJSON(String exportedDeckName); Map<String, Boolean> getAudioFilePaths(); @Override int describeContents(); @Override void writeToParcel(Parcel dest, int flags); static final Creator<Deck> CREATOR; }
@Test public void shouldReturnAudioPathMapForAllDictionaries() throws Exception { Dictionary firstDictionary = mock(Dictionary.class); Dictionary secondDictionary = mock(Dictionary.class); Dictionary[] dictionaries = {firstDictionary, secondDictionary}; Map<String, Boolean> firstDictionaryMap = new HashMap<>(); firstDictionaryMap.put("firstPath", false); firstDictionaryMap.put("secondPath", false); Map<String, Boolean> secondDictionaryMap = new HashMap<>(); secondDictionaryMap.put("thirdPath", false); secondDictionaryMap.put("fourthPath", false); when(firstDictionary.getAudioPaths()).thenReturn(firstDictionaryMap); when(secondDictionary.getAudioPaths()).thenReturn(secondDictionaryMap); Deck deck = new Deck(NO_VALUE, "author", NO_VALUE, -1, 1454946439262L, false, NO_VALUE, dictionaries); Map<String, Boolean> audioFilePaths = deck.getAudioFilePaths(); assertEquals(4, audioFilePaths.size()); assertTrue(audioFilePaths.keySet().containsAll(firstDictionary.getAudioPaths().keySet())); assertTrue(audioFilePaths.keySet().containsAll(secondDictionary.getAudioPaths().keySet())); }