/**
   * Asserts the use case of specifying null on construction for the detail type of the detail list.
   *
   * @throws Exception
   */
  public void testElementTypeNull() throws Exception {
    WritableValue observableValue =
        new WritableValue(new WritableList(new ArrayList(), Object.class), null);

    WritableListFactory factory = new WritableListFactory();
    DetailObservableList detailObservable =
        new DetailObservableList(factory, observableValue, null);
    assertNull(detailObservable.getElementType());

    // change the type returned from the factory
    factory.type = String.class;
    observableValue.setValue(new WritableList(new ArrayList(), String.class));
    assertNull("element type not null", detailObservable.getElementType());
  }
  /**
   * Asserts that you can't change the type across multiple inner observables.
   *
   * @throws Exception
   */
  public void testElementTypeNotNull() throws Exception {
    WritableValue observableValue =
        new WritableValue(new WritableList(new ArrayList(), Object.class), null);

    WritableListFactory factory = new WritableListFactory();
    DetailObservableList detailObservable =
        new DetailObservableList(factory, observableValue, Object.class);
    assertEquals(factory.type, detailObservable.getElementType());

    try {
      factory.type = String.class;
      observableValue.setValue(
          new WritableList(Arrays.asList(new Object[] {new Object()}), String.class));
      fail("if an element type is set this cannot be changed");
    } catch (AssertionFailedException e) {
    }
  }