### Question:
ProfileSelector extends SelectorDelegate<Profile> { public ProfileSelector bind(final Supplier<AbstractSession> sessionSupplier) { final AbstractSession session = sessionSupplier.get(); final Metadata metadata = session.getCanvasHandler().getDiagram().getMetadata(); final String definitionSetId = metadata.getDefinitionSetId(); final String profileId = metadata.getProfileId(); useDefinitionSet(definitionSetId); useProfile(definitionSetId, profileId); selector.setValueChangedCommand(() -> { final Profile item = selector.getSelectedItem(); metadata.setProfileId(item.getProfileId()); requestSessionRefreshEvent.fire(new RequestSessionRefreshEvent(session.getSessionUUID())); }); return this; } @Inject  ProfileSelector(final SelectorImpl<Profile> selector,
                           final ProfileManager profileManager,
                           final Event<RequestSessionRefreshEvent> requestSessionRefreshEvent); @PostConstruct void init(); ProfileSelector bind(final Supplier<AbstractSession> sessionSupplier);  }### Answer:
@Test public void testBind() { when(selector.getSelectedItem()).thenReturn(profile1); tested.bind(() -> session); verify(selector, times(1)).clear(); verify(selector, times(1)).addItem(eq(profile1)); ArgumentCaptor<Command> commandArgumentCaptor = ArgumentCaptor.forClass(Command.class); verify(selector, times(1)).setValueChangedCommand(commandArgumentCaptor.capture()); Command command = commandArgumentCaptor.getValue(); command.execute(); verify(metadata, times(1)).setProfileId(eq(PROFILE_ID)); ArgumentCaptor<RequestSessionRefreshEvent> eventArgumentCaptor = ArgumentCaptor.forClass(RequestSessionRefreshEvent.class); verify(requestSessionRefreshEvent, times(1)).fire(eventArgumentCaptor.capture()); RequestSessionRefreshEvent event = eventArgumentCaptor.getValue(); assertEquals(SESSION_UUID, event.getSessionUUID()); }