@Test public void testGetReferenceWhenHoveredDataTypeIsPresent() { final Optional<DataType> hoverDataType = Optional.of(mock(DataType.class)); final String uuid = "0000-1111-2222-3333"; when(hoverElement.getAttribute(UUID_ATTR)).thenReturn(uuid); when(dataTypeStore.get(uuid)).thenReturn(hoverDataType.get()); final Optional<DataType> reference = context.getReference(); assertEquals(hoverDataType, reference); }
Optional<DataType> getReference() { if (reloadHoveredDataType().isPresent() && hoveredDataTypeIsNotReadOnly()) { return getHoveredDataType(); } if (reloadPreviousDataType().isPresent()) { return getPreviousDataType(); } return getCurrentDataType().flatMap(this::getFirstDataType); }
DNDDataTypesHandlerContext { Optional<DataType> getReference() { if (reloadHoveredDataType().isPresent() && hoveredDataTypeIsNotReadOnly()) { return getHoveredDataType(); } if (reloadPreviousDataType().isPresent()) { return getPreviousDataType(); } return getCurrentDataType().flatMap(this::getFirstDataType); } }
DNDDataTypesHandlerContext { Optional<DataType> getReference() { if (reloadHoveredDataType().isPresent() && hoveredDataTypeIsNotReadOnly()) { return getHoveredDataType(); } if (reloadPreviousDataType().isPresent()) { return getPreviousDataType(); } return getCurrentDataType().flatMap(this::getFirstDataType); } DNDDataTypesHandlerContext(final DNDDataTypesHandler dndDataTypesHandler,
                               final Element currentElement,
                               final Element hoverElement); }
DNDDataTypesHandlerContext { Optional<DataType> getReference() { if (reloadHoveredDataType().isPresent() && hoveredDataTypeIsNotReadOnly()) { return getHoveredDataType(); } if (reloadPreviousDataType().isPresent()) { return getPreviousDataType(); } return getCurrentDataType().flatMap(this::getFirstDataType); } DNDDataTypesHandlerContext(final DNDDataTypesHandler dndDataTypesHandler,
                               final Element currentElement,
                               final Element hoverElement);  }
DNDDataTypesHandlerContext { Optional<DataType> getReference() { if (reloadHoveredDataType().isPresent() && hoveredDataTypeIsNotReadOnly()) { return getHoveredDataType(); } if (reloadPreviousDataType().isPresent()) { return getPreviousDataType(); } return getCurrentDataType().flatMap(this::getFirstDataType); } DNDDataTypesHandlerContext(final DNDDataTypesHandler dndDataTypesHandler,
                               final Element currentElement,
                               final Element hoverElement);   }