Returns a configured tree with rules and values for testing purposes @return A tree to test with
()
| 702 | * @return A tree to test with |
| 703 | */ |
| 704 | public static Tree buildTestTree() { |
| 705 | final Tree tree = new Tree(); |
| 706 | tree.setTreeId(1); |
| 707 | tree.setCreated(1356998400L); |
| 708 | tree.setDescription("My Description"); |
| 709 | tree.setName("Test Tree"); |
| 710 | tree.setNotes("Details"); |
| 711 | tree.setEnabled(true); |
| 712 | buildTestRuleSet(tree); |
| 713 | |
| 714 | // reset the changed field via reflection |
| 715 | Method reset; |
| 716 | try { |
| 717 | reset = Tree.class.getDeclaredMethod("initializeChangedMap"); |
| 718 | reset.setAccessible(true); |
| 719 | reset.invoke(tree); |
| 720 | reset.setAccessible(false); |
| 721 | // Since some other tests are calling this as a constructor, we can't throw |
| 722 | // exceptions. So just print them. |
| 723 | } catch (SecurityException e) { |
| 724 | e.printStackTrace(); |
| 725 | } catch (NoSuchMethodException e) { |
| 726 | e.printStackTrace(); |
| 727 | } catch (IllegalArgumentException e) { |
| 728 | e.printStackTrace(); |
| 729 | } catch (IllegalAccessException e) { |
| 730 | e.printStackTrace(); |
| 731 | } catch (InvocationTargetException e) { |
| 732 | e.printStackTrace(); |
| 733 | } |
| 734 | return tree; |
| 735 | } |
| 736 | |
| 737 | /** |
| 738 | * Mocks classes for testing the storage calls |
no test coverage detected