Permalink
Browse files

Looking for links based on rel, not title

  • Loading branch information...
christav committed Dec 13, 2012
1 parent 3494e05 commit c1e21262eac469d936c55e2c7f02fa79765455c2
@@ -70,28 +70,28 @@ protected T getContent() {
}
/**
- * Test if the entity contains a link with the given title.
+ * Test if the entity contains a link with the given rel attribute.
*
- * @param title
- * Title of link to check for
- * @return True if link is included, false if not.
+ * @param rel
+ * Rel of link to check for
+ * @return True if link is found, false if not.
*/
- public boolean hasLink(String title) {
- return getLink(title) != null;
+ public boolean hasLink(String rel) {
+ return getLink(rel) != null;
}
/**
- * Get the link with the given title
+ * Get the link with the given rel attribute
*
- * @param title
- * Title of link to retrieve
+ * @param rel
+ * rel of link to retrieve
* @return The link if found, null if not.
*/
- public LinkType getLink(String title) {
+ public LinkType getLink(String rel) {
for (Object child : entry.getEntryChildren()) {
LinkType link = LinkFromChild(child);
- if (link != null && link.getTitle().equals(title)) {
+ if (link != null && link.getRel().equals(rel)) {
return link;
}
}
@@ -75,7 +75,7 @@ public void setup() {
@Test
public void canRetrieveSingleLinkFromEntity() {
- assertTrue(info.hasLink("someLink"));
+ assertTrue(info.hasLink(link1.getRel()));
}
@Test
@@ -84,8 +84,8 @@ public void getFalseWhenLinkIsntThere() {
}
@Test
- public void canRetrieveEntireLinkByTitle() {
- LinkType link = info.getLink("someOtherLink");
+ public void canRetrieveEntireLinkByRel() {
+ LinkType link = info.getLink(link2.getRel());
assertLinksEqual(link2, link);
}

0 comments on commit c1e2126

Please sign in to comment.