From 012cf7cdbf2edec419f58b4bb0533a2771e515de Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Tue, 20 Sep 2016 23:35:55 +0100 Subject: [PATCH] ImmutableNodeItemTest: add test for Nodes::asImmutable for non-root --- .../java/net/kemitix/node/ImmutableNodeItemTest.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/test/java/net/kemitix/node/ImmutableNodeItemTest.java b/src/test/java/net/kemitix/node/ImmutableNodeItemTest.java index 411e9e5..3997ef3 100644 --- a/src/test/java/net/kemitix/node/ImmutableNodeItemTest.java +++ b/src/test/java/net/kemitix/node/ImmutableNodeItemTest.java @@ -418,4 +418,13 @@ public class ImmutableNodeItemTest { //when 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"))); + } }