Program: 76444
Project: 76444
Buggy source:
/** 
 * Tests to read properties on scalar parameters.
 * @throws SemanticException
 */
public void testGetsPropertiesOnParameter() throws SemanticException {
  SlotHandle params=designHandle.getParameters();
  ScalarParameterHandle handle=(ScalarParameterHandle)params.get(0);
  assertFalse(handle.isHidden());
  assertEquals(DesignChoiceConstants.PARAM_TYPE_DECIMAL,handle.getDataType());
  assertFalse(handle.isConcealValue());
  assertEquals("String_Node_Str",handle.getDefaultValue());
  assertFalse(handle.isRequired());
  assertEquals("String_Node_Str",handle.getPattern());
  assertEquals(DesignChoiceConstants.PARAM_CONTROL_CHECK_BOX,handle.getControlType());
  assertEquals(DesignChoiceConstants.SCALAR_PARAM_ALIGN_LEFT,handle.getAlignment());
  Iterator iter=handle.choiceIterator();
  int count=0;
  for (; iter.hasNext(); iter.next())   count++;
  assertEquals(0,count);
  assertEquals("String_Node_Str",handle.getHelpText());
  assertEquals("String_Node_Str",handle.getHelpTextKey());
  handle=(ScalarParameterHandle)params.get(1);
  assertFalse(handle.isHidden());
  assertEquals(DesignChoiceConstants.PARAM_TYPE_STRING,handle.getDataType());
  assertFalse(handle.isConcealValue());
  assertNull(handle.getDefaultValue());
  assertTrue(handle.isRequired());
  assertNull(handle.getPattern());
  assertNull(handle.getControlType());
  assertEquals(DesignChoiceConstants.SCALAR_PARAM_ALIGN_AUTO,handle.getAlignment());
  assertNull(handle.getHelpText());
  assertEquals("String_Node_Str",handle.getPromptText());
  handle.setPromptText("String_Node_Str");
  assertEquals("String_Node_Str",handle.getPromptText());
  assertEquals("String_Node_Str",handle.getPromptTextID());
  handle.setPromptTextID("String_Node_Str");
  assertEquals("String_Node_Str",handle.getPromptTextID());
  assertEquals("String_Node_Str",handle.getDataSetName());
  DataSetHandle dataSet=handle.getDataSet();
  assertEquals("String_Node_Str",dataSet.getName());
  assertEquals("String_Node_Str",handle.getValueExpr());
  assertEquals("String_Node_Str",handle.getLabelExpr());
  handle=(ScalarParameterHandle)params.get(2);
  assertTrue(handle.isMustMatch());
  assertFalse(handle.isFixedOrder());
  iter=handle.choiceIterator();
  assertNotNull(iter);
  count=0;
  for (; iter.hasNext(); iter.next())   count++;
  assertEquals(0,count);
  handle=(ScalarParameterHandle)params.get(3);
  assertTrue(handle.isMustMatch());
  assertTrue(handle.isFixedOrder());
  StructureHandle[] choices=new StructureHandle[3];
  count=0;
  for (iter=handle.choiceIterator(); iter.hasNext(); count++)   choices[count]=(StructureHandle)(iter.next());
  assertEquals(3,count);
  assertEquals("String_Node_Str",choices[0].getMember(SelectionChoice.VALUE_MEMBER).getValue());
  assertEquals("String_Node_Str",choices[0].getMember(SelectionChoice.LABEL_MEMBER).getValue());
  assertEquals("String_Node_Str",choices[0].getMember(SelectionChoice.LABEL_RESOURCE_KEY_MEMBER).getValue());
  assertEquals("String_Node_Str",choices[2].getMember(SelectionChoice.VALUE_MEMBER).getValue());
  assertNull(choices[2].getMember(SelectionChoice.LABEL_MEMBER).getValue());
  assertNull(choices[2].getMember(SelectionChoice.LABEL_RESOURCE_KEY_MEMBER).getValue());
}

Fixed version (ground truth):
/** 
 * Tests to read properties on scalar parameters.
 * @throws SemanticException
 */
public void testGetsPropertiesOnParameter() throws SemanticException {
  SlotHandle params=designHandle.getParameters();
  ScalarParameterHandle handle=(ScalarParameterHandle)params.get(4);
  assertEquals(DesignChoiceConstants.PARAM_TYPE_DATE,handle.getDataType());
  handle=(ScalarParameterHandle)params.get(5);
  assertEquals(DesignChoiceConstants.PARAM_TYPE_TIME,handle.getDataType());
  handle=(ScalarParameterHandle)params.get(0);
  assertFalse(handle.isHidden());
  assertEquals(DesignChoiceConstants.PARAM_TYPE_DECIMAL,handle.getDataType());
  assertFalse(handle.isConcealValue());
  assertEquals("String_Node_Str",handle.getDefaultValue());
  assertFalse(handle.isRequired());
  assertEquals("String_Node_Str",handle.getPattern());
  assertEquals(DesignChoiceConstants.PARAM_CONTROL_CHECK_BOX,handle.getControlType());
  assertEquals(DesignChoiceConstants.SCALAR_PARAM_ALIGN_LEFT,handle.getAlignment());
  Iterator iter=handle.choiceIterator();
  int count=0;
  for (; iter.hasNext(); iter.next())   count++;
  assertEquals(0,count);
  assertEquals("String_Node_Str",handle.getHelpText());
  assertEquals("String_Node_Str",handle.getHelpTextKey());
  handle=(ScalarParameterHandle)params.get(1);
  assertFalse(handle.isHidden());
  assertEquals(DesignChoiceConstants.PARAM_TYPE_STRING,handle.getDataType());
  assertFalse(handle.isConcealValue());
  assertNull(handle.getDefaultValue());
  assertTrue(handle.isRequired());
  assertNull(handle.getPattern());
  assertNull(handle.getControlType());
  assertEquals(DesignChoiceConstants.SCALAR_PARAM_ALIGN_AUTO,handle.getAlignment());
  assertNull(handle.getHelpText());
  assertEquals("String_Node_Str",handle.getPromptText());
  handle.setPromptText("String_Node_Str");
  assertEquals("String_Node_Str",handle.getPromptText());
  assertEquals("String_Node_Str",handle.getPromptTextID());
  handle.setPromptTextID("String_Node_Str");
  assertEquals("String_Node_Str",handle.getPromptTextID());
  assertEquals("String_Node_Str",handle.getDataSetName());
  DataSetHandle dataSet=handle.getDataSet();
  assertEquals("String_Node_Str",dataSet.getName());
  assertEquals("String_Node_Str",handle.getValueExpr());
  assertEquals("String_Node_Str",handle.getLabelExpr());
  handle=(ScalarParameterHandle)params.get(2);
  assertTrue(handle.isMustMatch());
  assertFalse(handle.isFixedOrder());
  iter=handle.choiceIterator();
  assertNotNull(iter);
  count=0;
  for (; iter.hasNext(); iter.next())   count++;
  assertEquals(0,count);
  handle=(ScalarParameterHandle)params.get(3);
  assertTrue(handle.isMustMatch());
  assertTrue(handle.isFixedOrder());
  StructureHandle[] choices=new StructureHandle[3];
  count=0;
  for (iter=handle.choiceIterator(); iter.hasNext(); count++)   choices[count]=(StructureHandle)(iter.next());
  assertEquals(3,count);
  assertEquals("String_Node_Str",choices[0].getMember(SelectionChoice.VALUE_MEMBER).getValue());
  assertEquals("String_Node_Str",choices[0].getMember(SelectionChoice.LABEL_MEMBER).getValue());
  assertEquals("String_Node_Str",choices[0].getMember(SelectionChoice.LABEL_RESOURCE_KEY_MEMBER).getValue());
  assertEquals("String_Node_Str",choices[2].getMember(SelectionChoice.VALUE_MEMBER).getValue());
  assertNull(choices[2].getMember(SelectionChoice.LABEL_MEMBER).getValue());
  assertNull(choices[2].getMember(SelectionChoice.LABEL_RESOURCE_KEY_MEMBER).getValue());
}