@Test public void getNameWithAbstractCanvasHandlerElementEvent() { final String expectedName = "name"; final NodeImpl<View> node = new NodeImpl<>("uuid"); final CanvasHandler canvasHandler = mock(CanvasHandler.class); final TextPropertyProvider textPropertyProvider = mock(TextPropertyProvider.class); final CanvasElementAddedEvent event = new CanvasElementAddedEvent(canvasHandler, node); when(textPropertyProviderFactory.getProvider(node)).thenReturn(textPropertyProvider); when(textPropertyProvider.getText(node)).thenReturn(expectedName); final Optional<String> actualName = utils.getName(event); assertTrue(actualName.isPresent()); assertEquals(expectedName, actualName.get()); }
public Optional<String> getName(final AbstractCanvasHandlerElementEvent event) { final Element<?> element = event.getElement(); if (element instanceof NodeImpl) { return Optional.ofNullable(getName(element)); } return Optional.empty(); }
GuidedTourUtils { public Optional<String> getName(final AbstractCanvasHandlerElementEvent event) { final Element<?> element = event.getElement(); if (element instanceof NodeImpl) { return Optional.ofNullable(getName(element)); } return Optional.empty(); } }
GuidedTourUtils { public Optional<String> getName(final AbstractCanvasHandlerElementEvent event) { final Element<?> element = event.getElement(); if (element instanceof NodeImpl) { return Optional.ofNullable(getName(element)); } return Optional.empty(); } @Inject  GuidedTourUtils(final TextPropertyProviderFactory textPropertyProviderFactory); }
GuidedTourUtils { public Optional<String> getName(final AbstractCanvasHandlerElementEvent event) { final Element<?> element = event.getElement(); if (element instanceof NodeImpl) { return Optional.ofNullable(getName(element)); } return Optional.empty(); } @Inject  GuidedTourUtils(final TextPropertyProviderFactory textPropertyProviderFactory); Optional<String> getName(final AbstractCanvasHandlerElementEvent event); String getName(final Element<?> element); String getName(final NodeImpl<View> node); @SuppressWarnings("unchecked") NodeImpl<View> asNodeImpl(final Element<?> element); }
GuidedTourUtils { public Optional<String> getName(final AbstractCanvasHandlerElementEvent event) { final Element<?> element = event.getElement(); if (element instanceof NodeImpl) { return Optional.ofNullable(getName(element)); } return Optional.empty(); } @Inject  GuidedTourUtils(final TextPropertyProviderFactory textPropertyProviderFactory); Optional<String> getName(final AbstractCanvasHandlerElementEvent event); String getName(final Element<?> element); String getName(final NodeImpl<View> node); @SuppressWarnings("unchecked") NodeImpl<View> asNodeImpl(final Element<?> element);  }