Program: 185160
Project: 185160
Buggy source:
@Test(dataProvider="String_Node_Str") public void testExtendedFieldRefresh(VisualControlDescriptor a,VisualControlDescriptor b){
  List<PropertyDescriptor> mockDescriptors=Arrays.asList(buildMockDescriptor(a),buildMockDescriptor(b));
  Mockito.when(comp.getFieldDescriptors()).thenReturn(mockDescriptors);
  PropertyDescriptor lastPropertyDescriptor=mockDescriptors.get(mockDescriptors.size() - 1);
  InfoView infoView=new InfoView(comp,info);
  for (  PropertyDescriptor mockDescriptor : mockDescriptors) {
switch (mockDescriptor.getVisualControlDescriptor()) {
case CheckBox:
case ComboBox:
      Mockito.verify(mockDescriptor.getPropertyEditor(),Mockito.times(1)).getValue();
    break;
case Label:
case TextField:
  Mockito.verify(mockDescriptor.getPropertyEditor(),Mockito.times(1)).getAsText();
break;
}
}
ActionEvent mockEvent=Mockito.mock(ActionEvent.class);
switch (lastPropertyDescriptor.getVisualControlDescriptor()) {
case CheckBox:
{
JCheckBox checkBox=findLastComponentOfType(infoView,JCheckBox.class);
checkBox.doClick();
break;
}
case ComboBox:
{
JComboBox comboBox=findLastComponentOfType(infoView,JComboBox.class);
comboBox.setSelectedItem("String_Node_Str");
break;
}
case Label:
{
break;
}
case TextField:
{
JTextField textField=findLastComponentOfType(infoView,JTextField.class);
textField.setText("String_Node_Str");
for (ActionListener listener : textField.getActionListeners()) {
if (listener.getClass().getName().startsWith("String_Node_Str")) {
listener.actionPerformed(mockEvent);
}
}
break;
}
case TextArea:
{
JTextArea textArea=findLastComponentOfType(infoView,JTextArea.class);
textArea.setText("String_Node_Str");
for (FocusListener listener : textArea.getFocusListeners()) {
if (listener.getClass().getName().startsWith("String_Node_Str")) {
listener.focusLost(Mockito.mock(FocusEvent.class));
}
}
break;
}
}
int expectedTimes=(lastPropertyDescriptor.getVisualControlDescriptor() == VisualControlDescriptor.Label) ? 1 : 2;
PropertyDescriptor mockDescriptor=mockDescriptors.get(0);
switch (mockDescriptor.getVisualControlDescriptor()) {
case CheckBox:
Mockito.verify(mockDescriptor.getPropertyEditor(),Mockito.times(expectedTimes)).getValue();
break;
case ComboBox:
Mockito.verify(mockDescriptor.getPropertyEditor(),Mockito.times(expectedTimes)).getValue();
break;
case Label:
Mockito.verify(mockDescriptor.getPropertyEditor(),Mockito.times(expectedTimes)).getAsText();
break;
case TextField:
Mockito.verify(mockDescriptor.getPropertyEditor(),Mockito.times(expectedTimes)).getAsText();
break;
case TextArea:
Mockito.verify(mockDescriptor.getPropertyEditor(),Mockito.times(expectedTimes)).getAsText();
break;
}
}

Fixed version (ground truth):
@Test(dataProvider="String_Node_Str") public void testExtendedFieldRefresh(VisualControlDescriptor a,VisualControlDescriptor b){
  List<PropertyDescriptor> mockDescriptors=Arrays.asList(buildMockDescriptor(a),buildMockDescriptor(b));
  Mockito.when(comp.getFieldDescriptors()).thenReturn(mockDescriptors);
  PropertyDescriptor lastPropertyDescriptor=mockDescriptors.get(mockDescriptors.size() - 1);
  InfoView infoView=new InfoView(comp,info);
  for (  PropertyDescriptor mockDescriptor : mockDescriptors) {
switch (mockDescriptor.getVisualControlDescriptor()) {
case CheckBox:
case ComboBox:
      Mockito.verify(mockDescriptor.getPropertyEditor(),Mockito.times(1)).getValue();
    break;
case Label:
case TextField:
  Mockito.verify(mockDescriptor.getPropertyEditor(),Mockito.times(1)).getAsText();
break;
}
}
ActionEvent mockEvent=Mockito.mock(ActionEvent.class);
switch (lastPropertyDescriptor.getVisualControlDescriptor()) {
case CheckBox:
{
JCheckBox checkBox=findLastComponentOfType(infoView,JCheckBox.class);
checkBox.doClick();
break;
}
case ComboBox:
{
@SuppressWarnings("String_Node_Str") JComboBox comboBox=findLastComponentOfType(infoView,JComboBox.class);
comboBox.setSelectedItem("String_Node_Str");
break;
}
case Label:
{
break;
}
case TextField:
{
JTextField textField=findLastComponentOfType(infoView,JTextField.class);
textField.setText("String_Node_Str");
for (ActionListener listener : textField.getActionListeners()) {
if (listener.getClass().getName().startsWith("String_Node_Str")) {
listener.actionPerformed(mockEvent);
}
}
break;
}
case TextArea:
{
JTextArea textArea=findLastComponentOfType(infoView,JTextArea.class);
textArea.setText("String_Node_Str");
for (FocusListener listener : textArea.getFocusListeners()) {
if (listener.getClass().getName().startsWith("String_Node_Str")) {
listener.focusLost(Mockito.mock(FocusEvent.class));
}
}
break;
}
}
int expectedTimes=(lastPropertyDescriptor.getVisualControlDescriptor() == VisualControlDescriptor.Label) ? 1 : 2;
PropertyDescriptor mockDescriptor=mockDescriptors.get(0);
switch (mockDescriptor.getVisualControlDescriptor()) {
case CheckBox:
Mockito.verify(mockDescriptor.getPropertyEditor(),Mockito.times(expectedTimes)).getValue();
break;
case ComboBox:
Mockito.verify(mockDescriptor.getPropertyEditor(),Mockito.times(expectedTimes)).getValue();
break;
case Label:
Mockito.verify(mockDescriptor.getPropertyEditor(),Mockito.times(expectedTimes)).getAsText();
break;
case TextField:
Mockito.verify(mockDescriptor.getPropertyEditor(),Mockito.times(expectedTimes)).getAsText();
break;
case TextArea:
Mockito.verify(mockDescriptor.getPropertyEditor(),Mockito.times(expectedTimes)).getAsText();
break;
}
}