1 package org.kuali.maven.plugins.graph.tree;
2
3 import java.util.Map;
4
5 import org.apache.commons.beanutils.BeanUtils;
6 import org.junit.Test;
7 import org.kuali.maven.plugins.graph.dot.GraphException;
8 import org.kuali.maven.plugins.graph.pojo.Scope;
9 import org.kuali.maven.plugins.graph.pojo.State;
10 import org.kuali.maven.plugins.graph.pojo.Style;
11 import org.kuali.maven.plugins.graph.tree.TreeHelper;
12
13 public class StyledTreeHelperTest {
14
15 @Test
16 public void test() {
17 try {
18 TreeHelper sth = new TreeHelper();
19 Style defaultStyle = sth.getStyle(Scope.COMPILE, false, State.INCLUDED);
20 System.out.println(describe(defaultStyle));
21 Style optional = sth.getStyle(Scope.COMPILE, true, State.INCLUDED);
22 System.out.println(describe(optional));
23 for (State state : State.values()) {
24 for (Scope scope : Scope.values()) {
25 Style theStyle = sth.getStyle(scope, false, state);
26 System.out.println(state.getValue() + " " + scope.getValue() + " " + describe(theStyle));
27 }
28 }
29 } catch (Exception e) {
30 e.printStackTrace();
31 }
32 }
33
34 protected Map<?, ?> describe(Object bean) {
35 try {
36 Map<?, ?> map = BeanUtils.describe(bean);
37 map.remove("class");
38 return map;
39 } catch (Exception e) {
40 throw new GraphException(e);
41 }
42 }
43
44 }