Skip to content

Commit

Permalink
Relax TCK to allow implementations to create a copy of maps/lists
Browse files Browse the repository at this point in the history
See eclipse#284

Signed-off-by: Jeremie Bresson <dev@jmini.fr>
  • Loading branch information
jmini committed Oct 13, 2018
1 parent 3ab25ae commit 7cbe3e2
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -953,14 +953,14 @@ private void processExtensible(Extensible<?> e) {
e.setExtensions(newMap);
final Map<String, Object> map2 = e.getExtensions();
assertEquals(map2.size(), 0, "The extensions map is expected to contain no entries.");
assertSame(map2, newMap, "The return value of getExtensions() is expected to be the same value that was set.");
assertEquals(map2, newMap, "The return value of getExtensions() is expected to be the same value that was set.");
// Check that the extension map can be replaced with the builder method and that it is returned by the getter.
final Map<String, Object> newOtherMap = new HashMap<>();
newOtherMap.put("x-test", 42);
e.setExtensions(newOtherMap);
final Map<String, Object> map3 = e.getExtensions();
assertEquals(map3.size(), 1, "The extensions map is expected to contain one entry.");
assertSame(map3, newOtherMap, "The return value of getExtensions() is expected to be the same value that was set.");
assertEquals(map3, newOtherMap, "The return value of getExtensions() is expected to be the same value that was set.");
}

private void processReference(Reference<?> r) {
Expand Down Expand Up @@ -993,7 +993,7 @@ private void processReference(Reference<?> r) {
private void processConstructibleProperty(Constructible o, Property p, Class<?> enclosingInterface) {
final Object value1 = getInstanceOf(p.getType(), false);
p.invokeSetter(o, value1);
if (!p.isPrimitive() && !p.isCompatible(Map.class)) {
if (!p.isPrimitive() && !p.isCompatible(Map.class) && !p.isCompatible(List.class)) {
assertSame(p.invokeGetter(o), value1, "The return value of the getter method for property \"" +
p.getName() + "\" of interface \"" + enclosingInterface.getName() +
"\" is expected to be the same as the value that was set.");
Expand All @@ -1009,7 +1009,7 @@ private void processConstructibleProperty(Constructible o, Property p, Class<?>
assertSame(self, o, "The return value of the builder method for property \"" +
p.getName() + "\" of interface \"" + enclosingInterface.getName() +
"\" is expected to be the same as the value that was set.");
if (!p.isPrimitive()) {
if (!p.isPrimitive() && !p.isCompatible(Map.class) && !p.isCompatible(List.class)) {
assertSame(p.invokeGetter(o), value2, "The return value of the getter method for property \"" +
p.getName() + "\" of interface \"" + enclosingInterface.getName() +
"\" is expected to be the same as the value that was set.");
Expand Down

0 comments on commit 7cbe3e2

Please sign in to comment.