Registry { public Link findByHref(final URI href) { for (final Link link : links) { if (link.getHref().equals(href)) { return link; } } return null; } Registry(final String name, final String title, final List<Link> links); String getName(); String getTitle(); Collection<Link> getAll(); Link findByHref(final URI href); Link asLinkFor(final URI baseUri);  }
@Test public void shouldFindLinksByHref() { final Link foo = new Link(create("http: final Link bar = new Link(create("http: final Registry registry = new Registry("fooBar", "", asList(foo, bar)); assertEquals(registry.findByHref(create("http: }
@Test public void shouldReturnNullIfHrefDoesNotExist() { final Registry registry = new Registry("foo", "", Collections.<Link>emptyList()); assertNull(registry.findByHref(create("http: }