Esempio n. 1
0
  @Test
  public void testSetFunctionOutOfOrder() {
    // Test that we can set the second function of a subtract
    CompositeFunction actual = new CompositeFunction();
    FunctionModelRoot modelRoot = new FunctionModelRoot(actual, provider);
    Subtract subtract = new Subtract();
    modelRoot.addFunction(subtract);
    SetFunctionModel[] setFunctionModel = modelRoot.getSetFunctionModel(subtract, 1);
    assertEquals(1, setFunctionModel.length);

    // If the ABinaryOperator's setFunction were to disallow setting index 1 before 0
    // then this would probably raise an exception
    setFunctionModel[0].setEditingValue("Gaussian");

    // If ABinaryOperator's setFunction put the function in the wrong place this would fail
    assertTreeLooksLike(
        modelRoot, Node.SUBTACT(Node.SET_FUNCTION, Node.GAUSSIAN), Node.ADD_NEW_FUNCTION);
  }