Program: 39150
Project: 39150
Buggy source:
@Test public void shouldSetFieldValidators(){
  assertFalse(dataDefinition.getField("String_Node_Str").isRequired());
  assertFalse(dataDefinition.getField("String_Node_Str").isUnique());
  assertTrue(dataDefinition.getField("String_Node_Str").isRequired());
  assertTrue(dataDefinition.getField("String_Node_Str").isUnique());
  assertEquals(0,((FieldDefinitionImpl)dataDefinition.getField("String_Node_Str")).getValidators().size());
  assertEquals(6,((FieldDefinitionImpl)dataDefinition.getField("String_Node_Str")).getValidators().size());
  List<FieldHookDefinition> validators=((FieldDefinitionImpl)dataDefinition.getField("String_Node_Str")).getValidators();
  assertThat(validators.get(0),instanceOf(RequiredValidator.class));
  assertThat(validators.get(1),instanceOf(UniqueValidator.class));
  assertThat(validators.get(2),instanceOf(CustomValidator.class));
  testHookDefinition(validators.get(2),"String_Node_Str",CustomHook.class,"String_Node_Str");
  assertThat(validators.get(3),instanceOf(LengthValidator.class));
  assertEquals(1,getField(validators.get(3),"String_Node_Str"));
  assertNull(getField(validators.get(3),"String_Node_Str"));
  assertEquals(3,getField(validators.get(3),"String_Node_Str"));
  assertThat(validators.get(4),instanceOf(UnscaledValueValidator.class));
  assertEquals(2,getField(validators.get(4),"String_Node_Str"));
  assertNull(getField(validators.get(4),"String_Node_Str"));
  assertEquals(4,getField(validators.get(4),"String_Node_Str"));
  assertThat(validators.get(5),instanceOf(RangeValidator.class));
  assertEquals(18,getField(validators.get(5),"String_Node_Str"));
  assertEquals(null,getField(validators.get(5),"String_Node_Str"));
  assertEquals(false,getField(validators.get(5),"String_Node_Str"));
  validators=((FieldDefinitionImpl)dataDefinition.getField("String_Node_Str")).getValidators();
  assertThat(validators.get(3),instanceOf(RegexValidator.class));
  assertEquals("String_Node_Str",getField(validators.get(3),"String_Node_Str"));
  validators=((FieldDefinitionImpl)dataDefinition.getField("String_Node_Str")).getValidators();
  assertThat(validators.get(0),instanceOf(ScaleValidator.class));
  assertEquals(2,getField(validators.get(0),"String_Node_Str"));
  assertNull(getField(validators.get(0),"String_Node_Str"));
  assertEquals(4,getField(validators.get(0),"String_Node_Str"));
  assertThat(validators.get(1),instanceOf(UnscaledValueValidator.class));
  assertNull(getField(validators.get(1),"String_Node_Str"));
  assertEquals(2,getField(validators.get(1),"String_Node_Str"));
  assertNull(getField(validators.get(1),"String_Node_Str"));
  validators=((FieldDefinitionImpl)dataDefinition.getField("String_Node_Str")).getValidators();
  assertThat(validators.get(0),instanceOf(ScaleValidator.class));
  assertEquals(2,getField(validators.get(0),"String_Node_Str"));
  assertNull(getField(validators.get(0),"String_Node_Str"));
  assertEquals(4,getField(validators.get(0),"String_Node_Str"));
  validators=((FieldDefinitionImpl)dataDefinition.getField("String_Node_Str")).getValidators();
  assertEquals(0,validators.size());
}

Fixed version (ground truth):
@Test public void shouldSetFieldValidators(){
  assertFalse(dataDefinition.getField("String_Node_Str").isRequired());
  assertFalse(dataDefinition.getField("String_Node_Str").isUnique());
  assertTrue(dataDefinition.getField("String_Node_Str").isRequired());
  assertTrue(dataDefinition.getField("String_Node_Str").isUnique());
  assertEquals(0,((FieldDefinitionImpl)dataDefinition.getField("String_Node_Str")).getValidators().size());
  assertEquals(6,((FieldDefinitionImpl)dataDefinition.getField("String_Node_Str")).getValidators().size());
  List<FieldHookDefinition> validators=((FieldDefinitionImpl)dataDefinition.getField("String_Node_Str")).getValidators();
  assertThat(validators.get(0),instanceOf(RequiredValidator.class));
  assertThat(validators.get(1),instanceOf(UniqueValidator.class));
  assertThat(validators.get(2),instanceOf(CustomValidator.class));
  testHookDefinition(validators.get(2),"String_Node_Str",CustomHook.class,"String_Node_Str");
  assertThat(validators.get(3),instanceOf(LengthValidator.class));
  assertEquals(1,getField(validators.get(3),"String_Node_Str"));
  assertNull(getField(validators.get(3),"String_Node_Str"));
  assertEquals(3,getField(validators.get(3),"String_Node_Str"));
  assertThat(validators.get(4),instanceOf(UnscaledValueValidator.class));
  assertEquals(2,getField(validators.get(4),"String_Node_Str"));
  assertNull(getField(validators.get(4),"String_Node_Str"));
  assertEquals(4,getField(validators.get(4),"String_Node_Str"));
  assertThat(validators.get(5),instanceOf(RangeValidator.class));
  assertEquals(18,getField(validators.get(5),"String_Node_Str"));
  assertEquals(null,getField(validators.get(5),"String_Node_Str"));
  assertEquals(false,getField(validators.get(5),"String_Node_Str"));
  validators=((FieldDefinitionImpl)dataDefinition.getField("String_Node_Str")).getValidators();
  assertThat(validators.get(3),instanceOf(RegexValidator.class));
  assertEquals("String_Node_Str",getField(validators.get(3),"String_Node_Str"));
  validators=((FieldDefinitionImpl)dataDefinition.getField("String_Node_Str")).getValidators();
  assertThat(validators.get(0),instanceOf(ScaleValidator.class));
  assertEquals(2,getField(validators.get(0),"String_Node_Str"));
  assertNull(getField(validators.get(0),"String_Node_Str"));
  assertEquals(4,getField(validators.get(0),"String_Node_Str"));
  assertThat(validators.get(1),instanceOf(UnscaledValueValidator.class));
  assertNull(getField(validators.get(1),"String_Node_Str"));
  assertEquals(2,getField(validators.get(1),"String_Node_Str"));
  assertNull(getField(validators.get(1),"String_Node_Str"));
  validators=((FieldDefinitionImpl)dataDefinition.getField("String_Node_Str")).getValidators();
  assertThat(validators.get(0),instanceOf(ScaleValidator.class));
  assertEquals(2,getField(validators.get(0),"String_Node_Str"));
  assertNull(getField(validators.get(0),"String_Node_Str"));
  assertEquals(4,getField(validators.get(0),"String_Node_Str"));
  validators=((FieldDefinitionImpl)dataDefinition.getField("String_Node_Str")).getValidators();
  assertEquals(2,validators.size());
}