@Test
  public void testRootUpdatedWhenChangedInScene() {
    Group g = new Group();
    Scene scene = new Scene(g);

    Group g2 = new Group();
    scene.setRoot(g2);

    assertNull(g.getScene());
    assertEquals(g2, scene.getRoot());
    assertEquals(scene, g2.getScene());
  }
  @Test
  public void testNodeTreeUpdatedWhenAddedToScene() {
    Rectangle rect;
    Group root = new Group();
    Scene scene = new Scene(root);
    Group g = new Group();

    g.getChildren().add(rect = new Rectangle());

    assertNull(rect.getScene());
    assertNull(g.getScene());

    root.getChildren().add(g);

    assertEquals(scene, g.getScene());
    assertEquals(scene, rect.getScene());
  }
  @Test
  public void testRootInitializedInConstructor() {
    Group g = new Group();
    Scene scene = new Scene(g);

    assertEquals(g, scene.getRoot());
    assertEquals(scene, g.getScene());
  }
  @Test
  public void testRootUpdatedWhenAddedToScene() {
    Scene scene = new Scene(new Group());

    Group g = new Group();
    scene.setRoot(g);

    assertEquals(g, scene.getRoot());
    assertEquals(scene, g.getScene());
  }
  @Test
  public void testNodeTreeUpdatedWhenAddedToChildOfScene() {
    Group parentGroup;
    Group root = new Group();
    Scene scene = new Scene(root);
    root.getChildren().add(parentGroup = new Group());

    Rectangle rect;
    Group childGroup = new Group();
    childGroup.getChildren().add(rect = new Rectangle());

    assertNull(rect.getScene());
    assertNull(childGroup.getScene());
    assertEquals(scene, parentGroup.getScene());

    parentGroup.getChildren().add(childGroup);

    assertEquals(scene, rect.getScene());
    assertEquals(scene, childGroup.getScene());
    assertEquals(scene, parentGroup.getScene());
  }