### Question:
AddProjectPopUpPresenter { public void restoreAdvancedOptions() { libraryPreferences.load(loadedLibraryPreferences -> { view.setVersion(loadedLibraryPreferences.getProjectPreferences().getVersion()); setDefaultArtifactId(); view.setGroupId(projectContext.getActiveOrganizationalUnit().isPresent() ? projectContext.getActiveOrganizationalUnit().get().getDefaultGroupId() : loadedLibraryPreferences.getOrganizationalUnitPreferences().getGroupId()); }, error -> { }); } @Inject  AddProjectPopUpPresenter(final Caller<LibraryService> libraryService,
                                    final BusyIndicatorView busyIndicatorView,
                                    final Event<NotificationEvent> notificationEvent,
                                    final LibraryPlaces libraryPlaces,
                                    final WorkspaceProjectContext projectContext,
                                    final View view,
                                    final SessionInfo sessionInfo,
                                    final Event<NewProjectEvent> newProjectEvent,
                                    final LibraryPreferences libraryPreferences,
                                    final ConflictingRepositoriesPopup conflictingRepositoriesPopup,
                                    final Caller<ValidationService> validationService,
                                    final ErrorPopup errorPopup,
                                    final TranslationService translationService,
                                    final Caller<WorkspaceProjectService> projectService,
                                    final Logger logger,
                                    final ArchetypePreferences archetypePreferences,
                                    final SpaceScopedResolutionStrategySupplier spaceScopedResolutionStrategySupplier); @PostConstruct void setup(); void setSuccessCallback(ParameterizedCommand<WorkspaceProject> successCallback); void show(); void add(); void onProjectIndexingFinishedEvent(@Observes IndexingFinishedEvent event); ParameterizedCommand<WorkspaceProject> getSuccessCallback(); ParameterizedCommand<WorkspaceProject> getProjectCreationSuccessCallback(); void cancel(); void setDefaultArtifactId(); void restoreAdvancedOptions();  }### Answer:
@Test public void testRestoreAdvancedOptionsWithActiveOrganizationalUnit() { LibraryPreferences loadedLibraryPreferences = mock(LibraryPreferences.class); LibraryProjectPreferences libraryProjectPreferences = mock(LibraryProjectPreferences.class); doReturn(libraryProjectPreferences).when(loadedLibraryPreferences).getProjectPreferences(); doReturn("version").when(libraryProjectPreferences).getVersion(); when(projectContext.getActiveOrganizationalUnit().get().getDefaultGroupId()).thenReturn("group"); when(view.getName()).thenReturn("Project Test"); executeParametrizedCommandWith(0, loadedLibraryPreferences).when(libraryPreferences).load(any(ParameterizedCommand.class), any(ParameterizedCommand.class)); presenter.restoreAdvancedOptions(); verify(libraryPreferences).load(any(ParameterizedCommand.class), any(ParameterizedCommand.class)); verify(view).setVersion("version"); verify(view).setGroupId("group"); verify(view, never()).setDescription(any()); verify(view).setArtifactId("ProjectTest"); }
@Test public void testRestoreAdvancedOptionsWithoutActiveOrganizationalUnit() { LibraryPreferences loadedLibraryPreferences = mock(LibraryPreferences.class); LibraryProjectPreferences libraryProjectPreferences = mock(LibraryProjectPreferences.class); LibraryOrganizationalUnitPreferences libraryOrganizationalUnitPreferences = mock(LibraryOrganizationalUnitPreferences.class); doReturn(libraryProjectPreferences).when(loadedLibraryPreferences).getProjectPreferences(); doReturn("version").when(libraryProjectPreferences).getVersion(); doReturn(libraryOrganizationalUnitPreferences).when(loadedLibraryPreferences).getOrganizationalUnitPreferences(); when(libraryOrganizationalUnitPreferences.getGroupId()).thenReturn("group"); when(projectContext.getActiveOrganizationalUnit()).thenReturn(Optional.empty()); when(view.getName()).thenReturn("Project Test"); executeParametrizedCommandWith(0, loadedLibraryPreferences).when(libraryPreferences).load(any(ParameterizedCommand.class), any(ParameterizedCommand.class)); presenter.restoreAdvancedOptions(); verify(view).setVersion("version"); verify(view).setGroupId("group"); verify(view, never()).setDescription(any()); verify(view).setArtifactId("ProjectTest"); }