### Question:
StunnerProjectPreferencesRegistryLoader extends StunnerPreferencesRegistryLoader { @Override public void load(final Metadata metadata, final ParameterizedCommand<StunnerPreferences> loadCompleteCallback, final ParameterizedCommand<Throwable> errorCallback) { super.load(metadata, preferences -> profilePreferencesLoader.load(metadata, profile -> { metadata.setProfileId(profile.getProfileId()); loadCompleteCallback.execute(preferences); }, errorCallback), errorCallback); } @Inject  StunnerProjectPreferencesRegistryLoader(final DefinitionUtils definitionUtils,
                                                   final @Any ManagedInstance<StunnerPreferencesRegistryHolder> preferencesHolders,
                                                   final StunnerPreferences preferences,
                                                   final StunnerTextPreferences textPreferences,
                                                   final StunnerProfilePreferencesLoader profilePreferencesLoader); @Override void load(final Metadata metadata,
                     final ParameterizedCommand<StunnerPreferences> loadCompleteCallback,
                     final ParameterizedCommand<Throwable> errorCallback);  }### Answer:
@Test @SuppressWarnings("unchecked") public void testLoad() { final ParameterizedCommand<StunnerPreferences> loadCompleteCallback = mock(ParameterizedCommand.class); final ParameterizedCommand<Throwable> errorCallback = mock(ParameterizedCommand.class); final StunnerPreferences pre = mock(StunnerPreferences.class); doAnswer(invocation -> { ((ParameterizedCommand<StunnerPreferences>) invocation.getArguments()[0]).execute(pre); return null; }).when(preferences).load(any(ParameterizedCommand.class), any(ParameterizedCommand.class)); tested.load(metadata, loadCompleteCallback, errorCallback); assertEquals(PROFILE_ID, metadata.getProfileId()); verify(preferencesHolders, times(1)).select(eq(qualifier)); verify(loadCompleteCallback, times(1)).execute(eq(pre)); verify(errorCallback, never()).execute(any(Throwable.class)); verify(preferencesHolder, times(1)).set(eq(pre), eq(StunnerPreferences.class)); verify(preferencesHolder, times(1)).set(eq(textPreferences), eq(StunnerTextPreferences.class)); }