public static RESTLink assertLinkExist( final SingleResourceTransportDto resource, final String href, final String expectedRel, final String expectedType, final String expectedTitle) { Optional<RESTLink> link = tryFind( resource.searchLinksByHref(href), new Predicate<RESTLink>() { @Override public boolean apply(final RESTLink input) { return expectedRel.equals(input.getRel()) && expectedType.equals(input.getType()) && expectedTitle.equals(input.getTitle()); } }); assertTrue( link.isPresent(), String.format( "link with 'href' %s 'rel' %s, type '%s' and title '%s' was not found", href, expectedRel, expectedType, expectedTitle)); return link.get(); }