Test of removeChild method, of class Place.
()
| 723 | * Test of removeChild method, of class Place. |
| 724 | */ |
| 725 | @Test |
| 726 | public void testRemoveChild() { |
| 727 | System.out.println("removeChild"); |
| 728 | |
| 729 | Layer layer2 = new Layer(world); |
| 730 | Layer layer3 = new Layer(world); |
| 731 | Place p1 = new Place("Child", 0, 0, layer2); |
| 732 | Place p2 = new Place("Child", 0, 0, layer3); |
| 733 | Place instance = new Place("MyPlace", 0, 0, layer); |
| 734 | instance.connectChild(p1); |
| 735 | instance.connectChild(p2); |
| 736 | // cross connection to to check that only one place is removed |
| 737 | p1.connectChild(p2); |
| 738 | |
| 739 | // pre conditions |
| 740 | assertEquals(2, instance.getChildren().size()); |
| 741 | assertEquals(1, p1.getParents().size()); |
| 742 | assertEquals(2, p2.getParents().size()); |
| 743 | |
| 744 | // removePlace child p1 from instance |
| 745 | instance.removeChild(p1); |
| 746 | assertEquals(1, instance.getChildren().size()); |
| 747 | assertEquals(0, p1.getParents().size()); |
| 748 | assertEquals(2, p2.getParents().size()); |
| 749 | |
| 750 | // removePlace child p2 from instance |
| 751 | instance.removeChild(p2); |
| 752 | assertEquals(0, instance.getChildren().size()); |
| 753 | assertEquals(0, p1.getParents().size()); |
| 754 | assertEquals(1, p2.getParents().size()); |
| 755 | |
| 756 | // test null |
| 757 | } |
| 758 | |
| 759 | /** |
| 760 | * Test of getChildren method, of class Place. |
nothing calls this directly
no test coverage detected