ImmutableNodeItemTest: add test for Nodes::asImmutable for non-root

This commit is contained in:
Paul Campbell 2016-09-20 23:35:55 +01:00
parent 2226d61b46
commit 012cf7cdbf

View file

@ -418,4 +418,13 @@ public class ImmutableNodeItemTest {
//when //when
immutableNode.insertInPath(null, ""); immutableNode.insertInPath(null, "");
} }
@Test
public void AsImmutableShouldThrowIAEWhenNotRoot() {
//given
exception.expect(IllegalArgumentException.class);
exception.expectMessage("source must be the root node");
//when
Nodes.asImmutable(Nodes.unnamedChild("child", Nodes.unnamedRoot("root")));
}
} }