TeaserImpl extends AbstractImageDelegatingModel implements Teaser { @Override public String getLinkURL() { if (this.linkURL == null) { this.linkURL = this.getTargetPage().map(page -> Utils.getURL(request, page)) .orElseGet(() -> { if (this.isActionsEnabled()) { return this.getActions().stream().findFirst() .map(ListItem::getURL) .orElse(null); } else { return this.resource.getValueMap().get(ImageResource.PN_LINK_URL, String.class); } }); } return linkURL; }  @Override boolean isActionsEnabled(); @Override List<ListItem> getActions(); @Override String getLinkURL(); @JsonProperty(value = "imagePath") @Nullable String getImagePath(); @Override boolean isImageLinkHidden(); @Override String getTitle(); @Override String getPretitle(); @Override boolean isTitleLinkHidden(); @Override String getDescription(); @Override String getTitleType(); @NotNull @Override String getExportedType(); @Override String getDataLayerTitle(); @Override String getDataLayerLinkUrl(); @Override String getDataLayerDescription(); final static String RESOURCE_TYPE; }
@Test void testTeaserWithoutLink() { Teaser teaser = getTeaserUnderTest(TEASER_4); assertNull(teaser.getLinkURL()); }
@Test void testTeaserWithExternalLinkFromAction() { Teaser teaser = getTeaserUnderTest(TEASER_7); assertEquals("http: }