Program: 39117
Project: 39117
Buggy source:
@Test public void shouldNumberBranchedTree() throws Exception {
  EntityTreeNode node1A1=getTreeNodeMock();
  EntityTreeNode node1B1=getTreeNodeMock(2);
  EntityTreeNode node1A2=getTreeNodeMock();
  EntityTreeNode node1A3=getTreeNodeMock();
  EntityTreeNode node1B1A1=getTreeNodeMock();
  EntityTreeNode node1B1A2=getTreeNodeMock();
  EntityTreeNode node1B1A2A1=getTreeNodeMock();
  EntityTreeNode node1B1A2B1=getTreeNodeMock();
  EntityTreeNode node1B1B1=getTreeNodeMock(2);
  EntityTreeNode node1B1B2=getTreeNodeMock();
  EntityTreeNode node1B1B3=getTreeNodeMock();
  when(rootNode.getChildren()).thenReturn(Lists.newArrayList(node1A1,node1B1));
  when(node1A1.getChildren()).thenReturn(Lists.newArrayList(node1A2));
  when(node1A2.getChildren()).thenReturn(Lists.newArrayList(node1A3));
  when(node1B1.getChildren()).thenReturn(Lists.newArrayList(node1B1A1,node1B1B1));
  when(node1B1A1.getChildren()).thenReturn(Lists.newArrayList(node1B1A2));
  when(node1B1A2.getChildren()).thenReturn(Lists.newArrayList(node1B1A2A1,node1B1A2B1));
  when(node1B1B1.getChildren()).thenReturn(Lists.newArrayList(node1B1B2));
  when(node1B1B2.getChildren()).thenReturn(Lists.newArrayList(node1B1B3));
  ArgumentCaptor<String> argument=ArgumentCaptor.forClass(String.class);
  treeNumberingService.generateTreeNumbers(tree);
  Mockito.verify(rootNode).setField(Mockito.eq(NODE_NUMBER_FIELD),argument.capture());
  assertEquals("String_Node_Str",argument.getValue());
  Mockito.verify(node1A1).setField(Mockito.eq(NODE_NUMBER_FIELD),argument.capture());
  assertEquals("String_Node_Str",argument.getValue());
  Mockito.verify(node1B1).setField(Mockito.eq(NODE_NUMBER_FIELD),argument.capture());
  assertEquals("String_Node_Str",argument.getValue());
  Mockito.verify(node1A2).setField(Mockito.eq(NODE_NUMBER_FIELD),argument.capture());
  assertEquals("String_Node_Str",argument.getValue());
  Mockito.verify(node1A3).setField(Mockito.eq(NODE_NUMBER_FIELD),argument.capture());
  assertEquals("String_Node_Str",argument.getValue());
  Mockito.verify(node1B1A1).setField(Mockito.eq(NODE_NUMBER_FIELD),argument.capture());
  assertEquals("String_Node_Str",argument.getValue());
  Mockito.verify(node1B1A2).setField(Mockito.eq(NODE_NUMBER_FIELD),argument.capture());
  assertEquals("String_Node_Str",argument.getValue());
  Mockito.verify(node1B1A2A1).setField(Mockito.eq(NODE_NUMBER_FIELD),argument.capture());
  assertEquals("String_Node_Str",argument.getValue());
  Mockito.verify(node1B1A2B1).setField(Mockito.eq(NODE_NUMBER_FIELD),argument.capture());
  assertEquals("String_Node_Str",argument.getValue());
  Mockito.verify(node1B1B1).setField(Mockito.eq(NODE_NUMBER_FIELD),argument.capture());
  assertEquals("String_Node_Str",argument.getValue());
  Mockito.verify(node1B1B2).setField(Mockito.eq(NODE_NUMBER_FIELD),argument.capture());
  assertEquals("String_Node_Str",argument.getValue());
  Mockito.verify(node1B1B3).setField(Mockito.eq(NODE_NUMBER_FIELD),argument.capture());
  assertEquals("String_Node_Str",argument.getValue());
}

Fixed version (ground truth):
@Ignore @Test public void shouldNumberBranchedTree() throws Exception {
  EntityTreeNode node1A1=getTreeNodeMock();
  EntityTreeNode node1B1=getTreeNodeMock(2);
  EntityTreeNode node1A2=getTreeNodeMock();
  EntityTreeNode node1A3=getTreeNodeMock();
  EntityTreeNode node1B1A1=getTreeNodeMock();
  EntityTreeNode node1B1A2=getTreeNodeMock();
  EntityTreeNode node1B1A2A1=getTreeNodeMock();
  EntityTreeNode node1B1A2B1=getTreeNodeMock();
  EntityTreeNode node1B1B1=getTreeNodeMock(2);
  EntityTreeNode node1B1B2=getTreeNodeMock();
  EntityTreeNode node1B1B3=getTreeNodeMock();
  when(rootNode.getChildren()).thenReturn(Lists.newArrayList(node1A1,node1B1));
  when(node1A1.getChildren()).thenReturn(Lists.newArrayList(node1A2));
  when(node1A2.getChildren()).thenReturn(Lists.newArrayList(node1A3));
  when(node1B1.getChildren()).thenReturn(Lists.newArrayList(node1B1A1,node1B1B1));
  when(node1B1A1.getChildren()).thenReturn(Lists.newArrayList(node1B1A2));
  when(node1B1A2.getChildren()).thenReturn(Lists.newArrayList(node1B1A2A1,node1B1A2B1));
  when(node1B1B1.getChildren()).thenReturn(Lists.newArrayList(node1B1B2));
  when(node1B1B2.getChildren()).thenReturn(Lists.newArrayList(node1B1B3));
  ArgumentCaptor<String> argument=ArgumentCaptor.forClass(String.class);
  treeNumberingService.generateTreeNumbers(tree);
  Mockito.verify(rootNode).setField(Mockito.eq(NODE_NUMBER_FIELD),argument.capture());
  assertEquals("String_Node_Str",argument.getValue());
  Mockito.verify(node1A1).setField(Mockito.eq(NODE_NUMBER_FIELD),argument.capture());
  assertEquals("String_Node_Str",argument.getValue());
  Mockito.verify(node1B1).setField(Mockito.eq(NODE_NUMBER_FIELD),argument.capture());
  assertEquals("String_Node_Str",argument.getValue());
  Mockito.verify(node1A2).setField(Mockito.eq(NODE_NUMBER_FIELD),argument.capture());
  assertEquals("String_Node_Str",argument.getValue());
  Mockito.verify(node1A3).setField(Mockito.eq(NODE_NUMBER_FIELD),argument.capture());
  assertEquals("String_Node_Str",argument.getValue());
  Mockito.verify(node1B1A1).setField(Mockito.eq(NODE_NUMBER_FIELD),argument.capture());
  assertEquals("String_Node_Str",argument.getValue());
  Mockito.verify(node1B1A2).setField(Mockito.eq(NODE_NUMBER_FIELD),argument.capture());
  assertEquals("String_Node_Str",argument.getValue());
  Mockito.verify(node1B1A2A1).setField(Mockito.eq(NODE_NUMBER_FIELD),argument.capture());
  assertEquals("String_Node_Str",argument.getValue());
  Mockito.verify(node1B1A2B1).setField(Mockito.eq(NODE_NUMBER_FIELD),argument.capture());
  assertEquals("String_Node_Str",argument.getValue());
  Mockito.verify(node1B1B1).setField(Mockito.eq(NODE_NUMBER_FIELD),argument.capture());
  assertEquals("String_Node_Str",argument.getValue());
  Mockito.verify(node1B1B2).setField(Mockito.eq(NODE_NUMBER_FIELD),argument.capture());
  assertEquals("String_Node_Str",argument.getValue());
  Mockito.verify(node1B1B3).setField(Mockito.eq(NODE_NUMBER_FIELD),argument.capture());
  assertEquals("String_Node_Str",argument.getValue());
}