CompositeNodeDecorator extends NodeDecorator { public static NodeDecorator compose(NodeDecorator... decorators) { ArgumentChecker.noNulls(decorators, "decorators"); switch (decorators.length) { case 0: return NodeDecorator.IDENTITY; case 1: return decorators[0]; default: return new CompositeNodeDecorator(ImmutableList.copyOf(decorators)); } } private  CompositeNodeDecorator(ImmutableList<NodeDecorator> decorators); static NodeDecorator compose(NodeDecorator... decorators); static NodeDecorator compose(List<NodeDecorator> decorators); @Override FunctionModelNode decorateNode(FunctionModelNode node);  }
@Test public void compose_array_empty() { NodeDecorator composed = CompositeNodeDecorator.compose(new NodeDecorator[0]); assertEquals(NodeDecorator.IDENTITY, composed); }
@Test public void compose_array_one() { NodeDecorator composed = CompositeNodeDecorator.compose(new NodeDecorator[] {NODE_DECORATOR}); assertEquals(NODE_DECORATOR, composed); }
@Test(expectedExceptions = IllegalArgumentException.class) public void compose_array_null() { CompositeNodeDecorator.compose((NodeDecorator[]) null); }
@Test(expectedExceptions = IllegalArgumentException.class) public void compose_array_nullEntry() { CompositeNodeDecorator.compose(new NodeDecorator[] {null}); }
@Test public void compose_list_empty() { NodeDecorator composed = CompositeNodeDecorator.compose(new ArrayList<NodeDecorator>()); assertEquals(NodeDecorator.IDENTITY, composed); }
@Test public void compose_list_one() { NodeDecorator composed = CompositeNodeDecorator.compose(Arrays.asList(NODE_DECORATOR)); assertEquals(NODE_DECORATOR, composed); }
@Test(expectedExceptions = IllegalArgumentException.class) public void compose_list_null() { CompositeNodeDecorator.compose((List<NodeDecorator>) null); }
@Test(expectedExceptions = IllegalArgumentException.class) public void compose_list_nullEntry() { CompositeNodeDecorator.compose(Arrays.asList((NodeDecorator) null)); }