001    package org.kuali.maven.plugins.graph.tree;
002    
003    import java.util.Map;
004    
005    import org.apache.commons.beanutils.BeanUtils;
006    import org.junit.Test;
007    import org.kuali.maven.plugins.graph.dot.GraphException;
008    import org.kuali.maven.plugins.graph.pojo.Scope;
009    import org.kuali.maven.plugins.graph.pojo.State;
010    import org.kuali.maven.plugins.graph.pojo.Style;
011    import org.kuali.maven.plugins.graph.tree.TreeHelper;
012    
013    public class StyledTreeHelperTest {
014    
015        @Test
016        public void test() {
017            try {
018                TreeHelper sth = new TreeHelper();
019                Style defaultStyle = sth.getStyle(Scope.COMPILE, false, State.INCLUDED);
020                System.out.println(describe(defaultStyle));
021                Style optional = sth.getStyle(Scope.COMPILE, true, State.INCLUDED);
022                System.out.println(describe(optional));
023                for (State state : State.values()) {
024                    for (Scope scope : Scope.values()) {
025                        Style theStyle = sth.getStyle(scope, false, state);
026                        System.out.println(state.getValue() + " " + scope.getValue() + " " + describe(theStyle));
027                    }
028                }
029            } catch (Exception e) {
030                e.printStackTrace();
031            }
032        }
033    
034        protected Map<?, ?> describe(Object bean) {
035            try {
036                Map<?, ?> map = BeanUtils.describe(bean);
037                map.remove("class");
038                return map;
039            } catch (Exception e) {
040                throw new GraphException(e);
041            }
042        }
043    
044    }