### Question:
ContextualPreferenceManager { public List<ContextualPreference> loadAll() { return contextualPreferenceDao.loadAll(); }  List<ContextualPreference> loadAll(); ContextualPreference load(final String name, final ContextualPreferenceExternalResource resource); ContextualPreference search(final List<String> preferences,
                                       final ContextualPreferenceExternalResource resource); ContextualPreference search(final List<String> preferences); @Transactional ContextualPreference upsert(final ContextualPreferenceVO preferenceVO); @Transactional ContextualPreference delete(final String name, final ContextualPreferenceExternalResource resource);  }### Answer:
@Test public void loadAllShouldReturnEmptyListIfThereAreNoPreferences() { when(contextualPreferenceDao.loadAll()).thenReturn(Collections.emptyList()); assertThat(manager.loadAll(), isEmpty()); verify(contextualPreferenceDao).loadAll(); }
@Test public void loadAllShouldReturnAllPreferences() { final ContextualPreference preference1 = new ContextualPreference(NAME, VALUE, toolResource); final ContextualPreference preference2 = new ContextualPreference(ANOTHER_NAME, VALUE, toolResource); when(contextualPreferenceDao.loadAll()).thenReturn(Arrays.asList(preference1, preference2)); assertThat(manager.loadAll(), containsInAnyOrder(preference1, preference2)); verify(contextualPreferenceDao).loadAll(); }