#825 - Comply with RFC8288 for LinkRelation matching.

Added several tests to ensure compliance with RFC8288.

Original pull request: #826.
This commit is contained in:
Greg Turnquist
2019-02-19 16:40:14 -06:00
committed by Oliver Drotbohm
parent 9131a82b90
commit 19036880b4
3 changed files with 26 additions and 2 deletions

View File

@@ -73,6 +73,6 @@ public interface LinkRelation {
Assert.notNull(relation, "LinkRelation must not be null!");
return this.value().equals(relation.value());
return this.value().equalsIgnoreCase(relation.value());
}
}

View File

@@ -54,7 +54,7 @@ class StringLinkRelation implements LinkRelation, Serializable {
Assert.hasText(relation, "Relation must not be null or empty!");
return CACHE.computeIfAbsent(relation, it -> new StringLinkRelation(it));
return CACHE.computeIfAbsent(relation, StringLinkRelation::new);
}
/*
@@ -75,4 +75,19 @@ class StringLinkRelation implements LinkRelation, Serializable {
public String toString() {
return value();
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
StringLinkRelation that = (StringLinkRelation) o;
return this.relation.equalsIgnoreCase(that.relation);
}
}