Fix bug that a list is mistakenly added as an element of another list
Change-Id: I1e4847b572e55bbf85f99ed8ef8df96da1f7bd7f
Showing
2 changed files
with
9 additions
and
1 deletions
... | @@ -70,7 +70,7 @@ public final class ResourceId { | ... | @@ -70,7 +70,7 @@ public final class ResourceId { |
70 | 70 | ||
71 | ResourceId child(Object child) { | 71 | ResourceId child(Object child) { |
72 | return new ResourceId(ImmutableList.builder() | 72 | return new ResourceId(ImmutableList.builder() |
73 | - .add(components) | 73 | + .addAll(components) |
74 | .add(child) | 74 | .add(child) |
75 | .build()); | 75 | .build()); |
76 | } | 76 | } | ... | ... |
... | @@ -75,6 +75,14 @@ public class ResourcePathTest { | ... | @@ -75,6 +75,14 @@ public class ResourcePathTest { |
75 | } | 75 | } |
76 | 76 | ||
77 | @Test | 77 | @Test |
78 | + public void testChild() { | ||
79 | + ResourcePath r1 = ResourcePath.discrete(D1).child(P1); | ||
80 | + ResourcePath sameAsR2 = ResourcePath.discrete(D1, P1); | ||
81 | + | ||
82 | + assertThat(r1, is(sameAsR2)); | ||
83 | + } | ||
84 | + | ||
85 | + @Test | ||
78 | public void testThereIsParent() { | 86 | public void testThereIsParent() { |
79 | ResourcePath path = ResourcePath.discrete(D1, P1, VLAN1); | 87 | ResourcePath path = ResourcePath.discrete(D1, P1, VLAN1); |
80 | ResourcePath parent = ResourcePath.discrete(D1, P1); | 88 | ResourcePath parent = ResourcePath.discrete(D1, P1); | ... | ... |
-
Please register or login to post a comment