nus-yam/ex-repair huggingface dataset:
Program: 39136
Project: 39136
Buggy source:
@Override public Collection<FieldHookDefinition> getMissingValidators(final Iterable<FieldHookDefinition> validators){
  for (  FieldHookDefinition validator : validators) {
    if (validator instanceof UnscaledValueValidator) {
      if (((UnscaledValueValidator)validator).hasUppuerBoundDefined()) {
        return Collections.emptyList();
      }
    }
  }
  return Lists.<FieldHookDefinition>newArrayList(new UnscaledValueValidator(null,null,NumberService.DEFAULT_INTEGER_UNSCALED_VALUE_MAX_LEN));
}

Fixed version (ground truth):
@Override public Collection<FieldHookDefinition> getMissingValidators(final Iterable<FieldHookDefinition> validators){
  for (  FieldHookDefinition validator : validators) {
    if (validator instanceof UnscaledValueValidator) {
      if (((UnscaledValueValidator)validator).hasUppuerBoundDefined()) {
        return Collections.emptyList();
      }
    }
  }
  return Lists.<FieldHookDefinition>newArrayList(new UnscaledValueValidator(null,null,NumberService.DEFAULT_MAX_DIGITS_IN_INTEGER));
}
Program: 39137
Project: 39137
Buggy source:
private boolean validateScale(final FieldDefinition fieldDefinition,final Object value,final Entity validatedEntity){
  int scale=((BigDecimal)value).scale();
  if (max != null && scale > max) {
    validatedEntity.addError(fieldDefinition,errorMessage + "String_Node_Str",max.toString());
    return false;
  }
  if (min != null && scale < min) {
    validatedEntity.addError(fieldDefinition,errorMessage + "String_Node_Str",min.toString());
    return false;
  }
  if (is != null && !is.equals(scale)) {
    validatedEntity.addError(fieldDefinition,errorMessage + "String_Node_Str",is.toString());
    return false;
  }
  return true;
}

Fixed version (ground truth):
private boolean validateScale(final FieldDefinition fieldDefinition,final Object value,final Entity validatedEntity){
  int scale=((BigDecimal)value).stripTrailingZeros().scale();
  if (max != null && scale > max) {
    validatedEntity.addError(fieldDefinition,errorMessage + "String_Node_Str",max.toString());
    return false;
  }
  if (min != null && scale < min) {
    validatedEntity.addError(fieldDefinition,errorMessage + "String_Node_Str",min.toString());
    return false;
  }
  if (is != null && !is.equals(scale)) {
    validatedEntity.addError(fieldDefinition,errorMessage + "String_Node_Str",is.toString());
    return false;
  }
  return true;
}
Program: 39138
Project: 39138
Buggy source:
@Test public final void shouldReturnBigDecimalValueFromStringUsingDecimalType() throws Exception {
  final String decimalStringValue="String_Node_Str";
  defaultEntity.setField(DECIMAL_FIELD_NAME,decimalStringValue);
  BigDecimal result=defaultEntity.getDecimalField(DECIMAL_FIELD_NAME);
  Assert.assertNotNull(result);
  Assert.assertEquals(new BigDecimal(decimalStringValue),result);
}

Fixed version (ground truth):
@Test public final void shouldReturnBigDecimalValueFromStringUsingDecimalType() throws Exception {
  final String decimalStringValue="String_Node_Str";
  defaultEntity.setField(DECIMAL_FIELD_NAME,decimalStringValue);
  BigDecimal result=defaultEntity.getDecimalField(DECIMAL_FIELD_NAME);
  Assert.assertNotNull(result);
  Assert.assertEquals(new BigDecimal(decimalStringValue).stripTrailingZeros(),result);
}
Program: 39139
Project: 39139
Buggy source:
@Override public PdfPTable addDynamicHeaderTableCell(final PdfPTable headerTable,final Map<String,Object> column,final Locale locale){
  if (column.keySet().size() == 0) {
    addTableCellAsOneColumnTable(headerTable,"String_Node_Str","String_Node_Str");
  }
 else {
    Object key=column.keySet().iterator().next();
    addTableCellAsOneColumnTable(headerTable,translationService.translate(key.toString(),locale),column.get(key));
    column.remove(key);
  }
  return headerTable;
}

Fixed version (ground truth):
@Override public PdfPTable addDynamicHeaderTableCell(final PdfPTable headerTable,final Map<String,Object> column,final Locale locale){
  if (column.keySet().size() != 0) {
    Object key=column.keySet().iterator().next();
    addTableCellAsOneColumnTable(headerTable,translationService.translate(key.toString(),locale),column.get(key));
    column.remove(key);
  }
  return headerTable;
}
Program: 39140
Project: 39140
Buggy source:
@Test public final void shouldReturnDateValueFromLong() throws Exception {
  Date date=new Date((Long)600000l);
  defaultEntity.setField(DATE_FIELD_NAME,date);
  Date result=defaultEntity.getDateField(DATE_FIELD_NAME);
  Assert.assertNotNull(result);
  Assert.assertEquals(date,result);
}

Fixed version (ground truth):
@Test public final void shouldReturnDateValueFromLong() throws Exception {
  Date date=new Date((Long)600000L);
  defaultEntity.setField(DATE_FIELD_NAME,date);
  Date result=defaultEntity.getDateField(DATE_FIELD_NAME);
  Assert.assertNotNull(result);
  Assert.assertEquals(date,result);
}
Program: 39141
Project: 39141
Buggy source:
private void addFieldElement(final XMLStreamReader reader,final FieldDefinitionImpl fieldDefinition,final FieldType type,final String tag) throws HookInitializationException, ModelXmlParsingException {
switch (FieldTag.valueOf(tag.toUpperCase(Locale.ENGLISH))) {
case VALIDATESLENGTH:
    fieldDefinition.withValidator(getValidatorDefinition(reader,new LengthValidator(getIntegerAttribute(reader,"String_Node_Str"),getIntegerAttribute(reader,"String_Node_Str"),getIntegerAttribute(reader,"String_Node_Str"))));
  break;
case VALIDATESUNSCALEDVALUE:
fieldDefinition.withValidator(getValidatorDefinition(reader,new UnscaledValueValidator(getIntegerAttribute(reader,"String_Node_Str"),getIntegerAttribute(reader,"String_Node_Str"),getIntegerAttribute(reader,"String_Node_Str"))));
break;
case VALIDATESSCALE:
fieldDefinition.withValidator(getValidatorDefinition(reader,new ScaleValidator(getIntegerAttribute(reader,"String_Node_Str"),getIntegerAttribute(reader,"String_Node_Str"),getIntegerAttribute(reader,"String_Node_Str"))));
break;
case VALIDATESRANGE:
Object from=getRangeForType(getStringAttribute(reader,"String_Node_Str"),type);
Object to=getRangeForType(getStringAttribute(reader,"String_Node_Str"),type);
boolean exclusively=getBooleanAttribute(reader,"String_Node_Str",false);
fieldDefinition.withValidator(getValidatorDefinition(reader,new RangeValidator(from,to,exclusively)));
break;
case VALIDATESWITH:
fieldDefinition.withValidator(getValidatorDefinition(reader,new CustomValidator(getFieldHookDefinition(reader))));
break;
case VALIDATESREGEX:
fieldDefinition.withValidator(getValidatorDefinition(reader,new RegexValidator(getStringAttribute(reader,"String_Node_Str"))));
break;
default :
throw new ModelXmlParsingException("String_Node_Str" + tag + "String_Node_Str");
}
}

Fixed version (ground truth):
private void addFieldElement(final XMLStreamReader reader,final DataDefinitionImpl dataDefinition,final String tag) throws XMLStreamException, HookInitializationException, ModelXmlParsingException {
  FieldsTag fieldTag=FieldsTag.valueOf(tag.toUpperCase(Locale.ENGLISH));
  if (fieldTag == PRIORITY) {
    dataDefinition.addPriorityField(getPriorityFieldDefinition(reader,dataDefinition));
  }
 else {
    dataDefinition.withField(getFieldDefinition(reader,dataDefinition,fieldTag));
  }
}
Program: 39143
Project: 39143
Buggy source:
private Entity buildUnitConversionItem(final String unitTo,final BigDecimal ratio){
  final Entity unitConversionItem=unitConversionItemDD.create();
  unitConversionItem.setField(UnitConversionItemFields.UNIT_FROM,unitFrom);
  unitConversionItem.setField(UnitConversionItemFields.UNIT_TO,unitTo);
  unitConversionItem.setField(UnitConversionItemFields.QUANTITY_FROM,BigDecimal.ONE);
  unitConversionItem.setField(UnitConversionItemFields.QUANTITY_TO,BigDecimal.ONE.multiply(ratio,mathContext));
  return unitConversionItem;
}

Fixed version (ground truth):
private Entity buildUnitConversionItem(final String unitTo,final BigDecimal ratio){
  final Entity unitConversionItem=unitConversionItemDD.create();
  unitConversionItem.setField(UnitConversionItemFields.UNIT_FROM,unitFrom);
  unitConversionItem.setField(UnitConversionItemFields.UNIT_TO,unitTo);
  unitConversionItem.setField(UnitConversionItemFields.QUANTITY_FROM,numberService.setScale(BigDecimal.ONE));
  unitConversionItem.setField(UnitConversionItemFields.QUANTITY_TO,numberService.setScale(BigDecimal.ONE.multiply(ratio)));
  return unitConversionItem;
}
Program: 39144
Project: 39144
Buggy source:
@Override public BigDecimal convertTo(final BigDecimal quantityFrom,final String unitTo){
  final BigDecimal ratio=targetUnitToFactor.get(unitTo);
  Preconditions.checkNotNull(ratio,"String_Node_Str" + unitFrom + "String_Node_Str"+ unitTo+ "String_Node_Str");
  return quantityFrom.multiply(ratio);
}

Fixed version (ground truth):
@Override public BigDecimal convertTo(final BigDecimal quantityFrom,final String unitTo){
  final BigDecimal ratio=targetUnitToFactor.get(unitTo);
  Preconditions.checkNotNull(ratio,"String_Node_Str" + unitFrom + "String_Node_Str"+ unitTo+ "String_Node_Str");
  return numberService.setScale(quantityFrom.multiply(ratio));
}
Program: 39145
Project: 39145
Buggy source:
@Override public void addConversion(final UnitConversion unitConversion){
  Preconditions.checkArgument(unitFrom.equals(unitConversion.getUnitFrom()),"String_Node_Str");
  final String unit=unitConversion.getUnitTo();
  if (!isDefinedFor(unit)) {
    targetUnitToFactor.put(unitConversion.getUnitTo(),applyMathContext(unitConversion.getRatio()));
  }
}

Fixed version (ground truth):
@Override public void addConversion(final UnitConversion unitConversion){
  Preconditions.checkArgument(unitFrom.equals(unitConversion.getUnitFrom()),"String_Node_Str");
  final String unit=unitConversion.getUnitTo();
  if (!isDefinedFor(unit)) {
    targetUnitToFactor.put(unitConversion.getUnitTo(),unitConversion.getRatio());
  }
}
Program: 39146
Project: 39146
Buggy source:
public PossibleUnitConversionsImpl(final String unitFrom,final MathContext mathContext,final DataDefinition unitConversionItemDD){
  Preconditions.checkNotNull(unitFrom);
  Preconditions.checkNotNull(mathContext);
  Preconditions.checkNotNull(unitConversionItemDD);
  this.unitFrom=unitFrom;
  this.mathContext=mathContext;
  this.unitConversionItemDD=unitConversionItemDD;
  this.targetUnitToFactor=Maps.newHashMap();
}

Fixed version (ground truth):
public PossibleUnitConversionsImpl(final String unitFrom,final NumberService numberService,final DataDefinition unitConversionItemDD){
  Preconditions.checkNotNull(unitFrom);
  Preconditions.checkNotNull(numberService);
  Preconditions.checkNotNull(unitConversionItemDD);
  this.unitFrom=unitFrom;
  this.numberService=numberService;
  this.unitConversionItemDD=unitConversionItemDD;
  this.targetUnitToFactor=Maps.newHashMap();
}
Program: 39147
Project: 39147
Buggy source:
private PossibleUnitConversions getPossibleConversions(final String unit,final List<Entity> matchingDomain){
  Preconditions.checkNotNull(unit);
  final InternalPossibleUnitConversions possibleUnitConversions=new PossibleUnitConversionsImpl(unit,numberService.getMathContext(),unitConversionModelService.getDataDefinition());
  final UnitConversion root=UnitConversionImpl.build(unit,numberService.getMathContext());
  traverse(possibleUnitConversions,root,convertEntities(matchingDomain));
  return possibleUnitConversions;
}

Fixed version (ground truth):
private PossibleUnitConversions getPossibleConversions(final String unit,final List<Entity> matchingDomain){
  Preconditions.checkNotNull(unit);
  final InternalPossibleUnitConversions possibleUnitConversions=new PossibleUnitConversionsImpl(unit,numberService,unitConversionModelService.getDataDefinition());
  final UnitConversion root=UnitConversionImpl.build(unit,numberService.getMathContext());
  traverse(possibleUnitConversions,root,convertEntities(matchingDomain));
  return possibleUnitConversions;
}
Program: 39148
Project: 39148
Buggy source:
private boolean validateScale(final FieldDefinition fieldDefinition,final Object value,final Entity validatedEntity){
  int scale=((BigDecimal)value).scale();
  if (max != null && scale > max) {
    validatedEntity.addError(fieldDefinition,errorMessage);
    return false;
  }
  if (min != null && scale < min) {
    validatedEntity.addError(fieldDefinition,errorMessage);
    return false;
  }
  if (is != null && !is.equals(scale)) {
    validatedEntity.addError(fieldDefinition,errorMessage);
    return false;
  }
  return true;
}

Fixed version (ground truth):
private boolean validateScale(final FieldDefinition fieldDefinition,final Object value,final Entity validatedEntity){
  int scale=((BigDecimal)value).scale();
  if (max != null && scale > max) {
    validatedEntity.addError(fieldDefinition,errorMessage + "String_Node_Str",max.toString());
    return false;
  }
  if (min != null && scale < min) {
    validatedEntity.addError(fieldDefinition,errorMessage + "String_Node_Str",min.toString());
    return false;
  }
  if (is != null && !is.equals(scale)) {
    validatedEntity.addError(fieldDefinition,errorMessage + "String_Node_Str",is.toString());
    return false;
  }
  return true;
}
Program: 39149
Project: 39149
Buggy source:
private boolean validatePresicion(final FieldDefinition fieldDefinition,final Entity validatedEntity,final int presicion){
  if (max != null && presicion > max) {
    validatedEntity.addError(fieldDefinition,errorMessage);
    return false;
  }
  if (min != null && presicion < min) {
    validatedEntity.addError(fieldDefinition,errorMessage);
    return false;
  }
  if (is != null && !is.equals(presicion)) {
    validatedEntity.addError(fieldDefinition,errorMessage);
    return false;
  }
  return true;
}

Fixed version (ground truth):
private boolean validatePresicion(final FieldDefinition fieldDefinition,final Entity validatedEntity,final int presicion){
  if (max != null && presicion > max) {
    validatedEntity.addError(fieldDefinition,errorMessage + "String_Node_Str",max.toString());
    return false;
  }
  if (min != null && presicion < min) {
    validatedEntity.addError(fieldDefinition,errorMessage + "String_Node_Str",min.toString());
    return false;
  }
  if (is != null && !is.equals(presicion)) {
    validatedEntity.addError(fieldDefinition,errorMessage + "String_Node_Str",is.toString());
    return false;
  }
  return true;
}
Program: 39151
Project: 39151
Buggy source:
@Before public final void init(){
  MockitoAnnotations.initMocks(this);
  this.possibleUnitConversionsImpl=new PossibleUnitConversionsImpl(UNIT_FROM,MathContext.DECIMAL64,unitConversionItemDD);
}

Fixed version (ground truth):
@Before public final void init(){
  MockitoAnnotations.initMocks(this);
  this.possibleUnitConversionsImpl=new PossibleUnitConversionsImpl(UNIT_FROM,numberService,unitConversionItemDD);
}
Program: 39152
Project: 39152
Buggy source:
@Test public final void shouldReturnConvertedValueIFConversionExists(){
  final String unitTo="String_Node_Str";
  possibleUnitConversionsImpl.addConversion(mockUnitConversion(UNIT_FROM,new BigDecimal("String_Node_Str"),unitTo));
  final BigDecimal result=possibleUnitConversionsImpl.convertTo(BigDecimal.valueOf(10L),unitTo);
  assertBigDecimalEquals(BigDecimal.valueOf(5L),result);
}

Fixed version (ground truth):
@Test @Ignore public final void shouldReturnConvertedValueIFConversionExists(){
  final String unitTo="String_Node_Str";
  possibleUnitConversionsImpl.addConversion(mockUnitConversion(UNIT_FROM,new BigDecimal("String_Node_Str"),unitTo));
  final BigDecimal result=possibleUnitConversionsImpl.convertTo(BigDecimal.valueOf(10L),unitTo);
  assertBigDecimalEquals(BigDecimal.valueOf(5L),result);
}
Program: 39153
Project: 39153
Buggy source:
@Test public final void shouldReturnNonEmptyConversionsSetUsingSimpleBiDirectionalTraverse(){
  final Entity kmToM=mockUnitConversionItem(BigDecimal.ONE,"String_Node_Str",BigDecimal.valueOf(1000L),"String_Node_Str");
  final Entity mToDm=mockUnitConversionItem(BigDecimal.ONE,"String_Node_Str",BigDecimal.valueOf(100L),"String_Node_Str");
  final Entity cmToMm=mockUnitConversionItem(BigDecimal.ONE,"String_Node_Str",BigDecimal.valueOf(10L),"String_Node_Str");
  stubGetAll(Lists.newArrayList(mToDm,kmToM,cmToMm));
  final PossibleUnitConversions result=unitConversionService.getPossibleConversions("String_Node_Str");
  assertEquals(3,result.asUnitToConversionMap().size());
  assertBigDecimalEquals(new BigDecimal("String_Node_Str"),result.convertTo(BigDecimal.ONE,"String_Node_Str"));
  assertBigDecimalEquals(BigDecimal.valueOf(100L),result.convertTo(BigDecimal.ONE,"String_Node_Str"));
  assertBigDecimalEquals(BigDecimal.valueOf(1000L),result.convertTo(BigDecimal.ONE,"String_Node_Str"));
}

Fixed version (ground truth):
@Test @Ignore public final void shouldReturnNonEmptyConversionsSetUsingSimpleBiDirectionalTraverse(){
  final Entity kmToM=mockUnitConversionItem(BigDecimal.ONE,"String_Node_Str",BigDecimal.valueOf(1000L),"String_Node_Str");
  final Entity mToDm=mockUnitConversionItem(BigDecimal.ONE,"String_Node_Str",BigDecimal.valueOf(100L),"String_Node_Str");
  final Entity cmToMm=mockUnitConversionItem(BigDecimal.ONE,"String_Node_Str",BigDecimal.valueOf(10L),"String_Node_Str");
  stubGetAll(Lists.newArrayList(mToDm,kmToM,cmToMm));
  final PossibleUnitConversions result=unitConversionService.getPossibleConversions("String_Node_Str");
  assertEquals(3,result.asUnitToConversionMap().size());
  assertBigDecimalEquals(new BigDecimal("String_Node_Str"),result.convertTo(BigDecimal.ONE,"String_Node_Str"));
  assertBigDecimalEquals(BigDecimal.valueOf(100L),result.convertTo(BigDecimal.ONE,"String_Node_Str"));
  assertBigDecimalEquals(BigDecimal.valueOf(1000L),result.convertTo(BigDecimal.ONE,"String_Node_Str"));
}
Program: 39154
Project: 39154
Buggy source:
@Test public final void shouldReturnNonEmptyConversionsSetUsingSimpleOneDirectionalTraverseWithCycle(){
  final Entity mToDm=mockUnitConversionItem(BigDecimal.ONE,"String_Node_Str",BigDecimal.valueOf(10L),"String_Node_Str");
  final Entity dmToCm=mockUnitConversionItem(BigDecimal.ONE,"String_Node_Str",BigDecimal.valueOf(10L),"String_Node_Str");
  final Entity cmToMm=mockUnitConversionItem(BigDecimal.ONE,"String_Node_Str",BigDecimal.valueOf(10L),"String_Node_Str");
  final Entity mmToM=mockUnitConversionItem(BigDecimal.ONE,"String_Node_Str",new BigDecimal("String_Node_Str"),"String_Node_Str");
  stubGetAll(Lists.newArrayList(mToDm,dmToCm,cmToMm,mmToM));
  final PossibleUnitConversions result=unitConversionService.getPossibleConversions("String_Node_Str");
  assertEquals(3,result.asUnitToConversionMap().size());
  assertBigDecimalEquals(BigDecimal.valueOf(10L),result.convertTo(BigDecimal.ONE,"String_Node_Str"));
  assertBigDecimalEquals(BigDecimal.valueOf(100L),result.convertTo(BigDecimal.ONE,"String_Node_Str"));
  assertBigDecimalEquals(BigDecimal.valueOf(1000L),result.convertTo(BigDecimal.ONE,"String_Node_Str"));
}

Fixed version (ground truth):
@Test @Ignore public final void shouldReturnNonEmptyConversionsSetUsingSimpleOneDirectionalTraverseWithCycle(){
  final Entity mToDm=mockUnitConversionItem(BigDecimal.ONE,"String_Node_Str",BigDecimal.valueOf(10L),"String_Node_Str");
  final Entity dmToCm=mockUnitConversionItem(BigDecimal.ONE,"String_Node_Str",BigDecimal.valueOf(10L),"String_Node_Str");
  final Entity cmToMm=mockUnitConversionItem(BigDecimal.ONE,"String_Node_Str",BigDecimal.valueOf(10L),"String_Node_Str");
  final Entity mmToM=mockUnitConversionItem(BigDecimal.ONE,"String_Node_Str",new BigDecimal("String_Node_Str"),"String_Node_Str");
  stubGetAll(Lists.newArrayList(mToDm,dmToCm,cmToMm,mmToM));
  final PossibleUnitConversions result=unitConversionService.getPossibleConversions("String_Node_Str");
  assertEquals(3,result.asUnitToConversionMap().size());
  assertBigDecimalEquals(BigDecimal.valueOf(10L),result.convertTo(BigDecimal.ONE,"String_Node_Str"));
  assertBigDecimalEquals(BigDecimal.valueOf(100L),result.convertTo(BigDecimal.ONE,"String_Node_Str"));
  assertBigDecimalEquals(BigDecimal.valueOf(1000L),result.convertTo(BigDecimal.ONE,"String_Node_Str"));
}
Program: 39155
Project: 39155
Buggy source:
@Test public final void shouldReturnNonEmptyConversionsSetUsingSimpleOneDirectionalTraverse(){
  final Entity mToDm=mockUnitConversionItem(BigDecimal.ONE,"String_Node_Str",BigDecimal.valueOf(10L),"String_Node_Str");
  final Entity dmToCm=mockUnitConversionItem(BigDecimal.ONE,"String_Node_Str",BigDecimal.valueOf(10L),"String_Node_Str");
  final Entity cmToMm=mockUnitConversionItem(BigDecimal.ONE,"String_Node_Str",BigDecimal.valueOf(10L),"String_Node_Str");
  stubGetAll(Lists.newArrayList(mToDm,dmToCm,cmToMm));
  final PossibleUnitConversions result=unitConversionService.getPossibleConversions("String_Node_Str");
  assertEquals(3,result.asUnitToConversionMap().size());
  assertBigDecimalEquals(BigDecimal.valueOf(10L),result.convertTo(BigDecimal.ONE,"String_Node_Str"));
  assertBigDecimalEquals(BigDecimal.valueOf(100L),result.convertTo(BigDecimal.ONE,"String_Node_Str"));
  assertBigDecimalEquals(BigDecimal.valueOf(1000L),result.convertTo(BigDecimal.ONE,"String_Node_Str"));
}

Fixed version (ground truth):
@Test @Ignore public final void shouldReturnNonEmptyConversionsSetUsingSimpleOneDirectionalTraverse(){
  final Entity mToDm=mockUnitConversionItem(BigDecimal.ONE,"String_Node_Str",BigDecimal.valueOf(10L),"String_Node_Str");
  final Entity dmToCm=mockUnitConversionItem(BigDecimal.ONE,"String_Node_Str",BigDecimal.valueOf(10L),"String_Node_Str");
  final Entity cmToMm=mockUnitConversionItem(BigDecimal.ONE,"String_Node_Str",BigDecimal.valueOf(10L),"String_Node_Str");
  stubGetAll(Lists.newArrayList(mToDm,dmToCm,cmToMm));
  final PossibleUnitConversions result=unitConversionService.getPossibleConversions("String_Node_Str");
  assertEquals(3,result.asUnitToConversionMap().size());
  assertBigDecimalEquals(BigDecimal.valueOf(10L),result.convertTo(BigDecimal.ONE,"String_Node_Str"));
  assertBigDecimalEquals(BigDecimal.valueOf(100L),result.convertTo(BigDecimal.ONE,"String_Node_Str"));
  assertBigDecimalEquals(BigDecimal.valueOf(1000L),result.convertTo(BigDecimal.ONE,"String_Node_Str"));
}
Program: 39156
Project: 39156
Buggy source:
@Test public final void shouldReturnNonEmptyConversionsSetUsingSimpleBiDirectionalTraverseWithCycle(){
  final Entity kmToM=mockUnitConversionItem(BigDecimal.ONE,"String_Node_Str",BigDecimal.valueOf(1000L),"String_Node_Str");
  final Entity mToDm=mockUnitConversionItem(BigDecimal.ONE,"String_Node_Str",BigDecimal.valueOf(10L),"String_Node_Str");
  final Entity kmToMm=mockUnitConversionItem(BigDecimal.ONE,"String_Node_Str",BigDecimal.valueOf(1000000L),"String_Node_Str");
  final Entity mmToDm=mockUnitConversionItem(BigDecimal.valueOf(100L),"String_Node_Str",BigDecimal.ONE,"String_Node_Str");
  final Entity dmToM=mockUnitConversionItem(BigDecimal.valueOf(10L),"String_Node_Str",BigDecimal.ONE,"String_Node_Str");
  stubGetAll(Lists.newArrayList(mToDm,kmToM,kmToMm,mmToDm,dmToM));
  final PossibleUnitConversions result=unitConversionService.getPossibleConversions("String_Node_Str");
  assertEquals(3,result.asUnitToConversionMap().size());
  assertBigDecimalEquals(new BigDecimal("String_Node_Str"),result.convertTo(BigDecimal.ONE,"String_Node_Str"));
  assertBigDecimalEquals(BigDecimal.valueOf(10L),result.convertTo(BigDecimal.ONE,"String_Node_Str"));
  assertBigDecimalEquals(BigDecimal.valueOf(1000L),result.convertTo(BigDecimal.ONE,"String_Node_Str"));
}

Fixed version (ground truth):
@Test @Ignore public final void shouldReturnNonEmptyConversionsSetUsingSimpleBiDirectionalTraverseWithCycle(){
  final Entity kmToM=mockUnitConversionItem(BigDecimal.ONE,"String_Node_Str",BigDecimal.valueOf(1000L),"String_Node_Str");
  final Entity mToDm=mockUnitConversionItem(BigDecimal.ONE,"String_Node_Str",BigDecimal.valueOf(10L),"String_Node_Str");
  final Entity kmToMm=mockUnitConversionItem(BigDecimal.ONE,"String_Node_Str",BigDecimal.valueOf(1000000L),"String_Node_Str");
  final Entity mmToDm=mockUnitConversionItem(BigDecimal.valueOf(100L),"String_Node_Str",BigDecimal.ONE,"String_Node_Str");
  final Entity dmToM=mockUnitConversionItem(BigDecimal.valueOf(10L),"String_Node_Str",BigDecimal.ONE,"String_Node_Str");
  stubGetAll(Lists.newArrayList(mToDm,kmToM,kmToMm,mmToDm,dmToM));
  final PossibleUnitConversions result=unitConversionService.getPossibleConversions("String_Node_Str");
  assertEquals(3,result.asUnitToConversionMap().size());
  assertBigDecimalEquals(new BigDecimal("String_Node_Str"),result.convertTo(BigDecimal.ONE,"String_Node_Str"));
  assertBigDecimalEquals(BigDecimal.valueOf(10L),result.convertTo(BigDecimal.ONE,"String_Node_Str"));
  assertBigDecimalEquals(BigDecimal.valueOf(1000L),result.convertTo(BigDecimal.ONE,"String_Node_Str"));
}
Program: 39157
Project: 39157
Buggy source:
public void disableWhenRoleIsSuperadmin(final ViewDefinitionState state){
  FieldComponent role=(FieldComponent)state.getComponentByReference("String_Node_Str");
  if (QcadooUsersConstants.ROLE_SUPERADMIN.equals(role.getFieldValue())) {
    role.setEnabled(false);
  }
 else {
    role.setEnabled(true);
  }
}

Fixed version (ground truth):
public void disableWhenRoleIsSuperadmin(final ViewDefinitionState state){
  FormComponent form=(FormComponent)state.getComponentByReference("String_Node_Str");
  FieldComponent role=(FieldComponent)state.getComponentByReference("String_Node_Str");
  if ((form.getEntityId() != null) && QcadooUsersConstants.ROLE_SUPERADMIN.equals(role.getFieldValue())) {
    role.setEnabled(false);
  }
 else {
    role.setEnabled(true);
  }
}
Program: 39158
Project: 39158
Buggy source:
@Override public BigDecimal setScale(final BigDecimal decimal){
  return decimal.setScale(5,HALF_EVEN);
}

Fixed version (ground truth):
@Override public BigDecimal setScale(final BigDecimal decimal){
  return decimal.setScale(PRECISION,ROUNDING_MODE);
}
Program: 39159
Project: 39159
Buggy source:
@Override public String format(final Object obj){
  return (obj == null) ? null : decimalFormat.format(obj);
}

Fixed version (ground truth):
@Override public String format(final Object obj){
  String formattedNumber=null;
  if (obj != null) {
    formattedNumber=getDecimalFormat().format(obj);
  }
  return formattedNumber;
}
Program: 39160
Project: 39160
Buggy source:
@Override @Monitorable public Long getCurrentUserId(){
  String login=SecurityContextHolder.getContext().getAuthentication().getName();
  Entity entity=getUserEntity(SecurityContextHolder.getContext().getAuthentication().getName());
  checkNotNull(entity,"String_Node_Str",login);
  return entity.getId();
}

Fixed version (ground truth):
@Override @Monitorable public Long getCurrentUserId(){
  String login=SecurityContextHolder.getContext().getAuthentication().getName();
  Entity entity=getUserEntity(login);
  checkNotNull(entity,"String_Node_Str",login);
  return entity.getId();
}
Program: 39161
Project: 39161
Buggy source:
public boolean checkUserCreatingSuperadmin(final DataDefinition dataDefinition,final Entity entity){
  String role=entity.getStringField("String_Node_Str");
  if (QcadooSecurityConstants.ROLE_SUPERADMIN.equals(role) && securityService.getCurrentUserName() != null) {
    entity.addError(dataDefinition.getField("String_Node_Str"),"String_Node_Str");
    return false;
  }
  return true;
}

Fixed version (ground truth):
private boolean checkUserCreatingSuperadmin(final DataDefinition dataDefinition,final FieldDefinition fieldDefinition,final Entity entity,final Object oldValue,final Object newValue){
  if (Objects.equal(oldValue,newValue) || isCurrentUserShopOrSuperAdmin(entity,dataDefinition) || !QcadooSecurityConstants.ROLE_SUPERADMIN.equals(newValue)) {
    return true;
  }
  entity.addError(fieldDefinition,"String_Node_Str");
  return false;
}
Program: 39162
Project: 39162
Buggy source:
public GridComponentColumn(final String name){
  this.name=name;
}

Fixed version (ground truth):
public GridComponentColumn(final String name,final String extendingPluginIdentifier){
  this.name=name;
  this.extendingPluginIdentifier=extendingPluginIdentifier;
}
Program: 39163
Project: 39163
Buggy source:
private JSONArray getColumnsForJsOptions(final Locale locale) throws JSONException {
  JSONArray jsonColumns=new JSONArray();
  String nameTranslation=null;
  for (  GridComponentColumn column : columns.values()) {
    if (column.getFields().size() == 1) {
      String fieldCode=getDataDefinition().getPluginIdentifier() + "String_Node_Str" + getDataDefinition().getName()+ "String_Node_Str"+ column.getFields().get(0).getName();
      nameTranslation=getTranslationService().translate(getTranslationPath() + "String_Node_Str" + column.getName(),fieldCode + "String_Node_Str",locale);
    }
 else {
      nameTranslation=getTranslationService().translate(getTranslationPath() + "String_Node_Str" + column.getName(),locale);
    }
    JSONObject jsonColumn=new JSONObject();
    jsonColumn.put("String_Node_Str",column.getName());
    jsonColumn.put("String_Node_Str",nameTranslation);
    jsonColumn.put("String_Node_Str",column.isLink());
    jsonColumn.put("String_Node_Str",column.isHidden());
    jsonColumn.put(L_WIDTH,column.getWidth());
    jsonColumn.put("String_Node_Str",column.getAlign());
    jsonColumn.put("String_Node_Str",getFilterValuesForColumn(column,locale));
    jsonColumns.put(jsonColumn);
  }
  return jsonColumns;
}

Fixed version (ground truth):
private JSONArray getColumnsForJsOptions(final Locale locale) throws JSONException {
  JSONArray jsonColumns=new JSONArray();
  String nameTranslation=null;
  for (  GridComponentColumn column : columns.values()) {
    if (!COLUMNS_VISIBLE_FOR_TENANT_PREDICATE.apply(column)) {
      continue;
    }
    if (column.getFields().size() == 1) {
      String fieldCode=getDataDefinition().getPluginIdentifier() + "String_Node_Str" + getDataDefinition().getName()+ "String_Node_Str"+ column.getFields().get(0).getName();
      nameTranslation=getTranslationService().translate(getTranslationPath() + "String_Node_Str" + column.getName(),fieldCode + "String_Node_Str",locale);
    }
 else {
      nameTranslation=getTranslationService().translate(getTranslationPath() + "String_Node_Str" + column.getName(),locale);
    }
    JSONObject jsonColumn=new JSONObject();
    jsonColumn.put("String_Node_Str",column.getName());
    jsonColumn.put("String_Node_Str",nameTranslation);
    jsonColumn.put("String_Node_Str",column.isLink());
    jsonColumn.put("String_Node_Str",column.isHidden());
    jsonColumn.put(L_WIDTH,column.getWidth());
    jsonColumn.put("String_Node_Str",column.getAlign());
    jsonColumn.put("String_Node_Str",getFilterValuesForColumn(column,locale));
    jsonColumns.put(jsonColumn);
  }
  return jsonColumns;
}
Program: 39164
Project: 39164
Buggy source:
public Map<String,GridComponentColumn> getColumns(){
  return columns;
}

Fixed version (ground truth):
public Map<String,GridComponentColumn> getColumns(){
  return Maps.filterEntries(columns,Predicates.compose(COLUMNS_VISIBLE_FOR_TENANT_PREDICATE,VALUE_FROM_MAP_ENTRY_FUNCTION));
}
Program: 39165
Project: 39165
Buggy source:
public void addColumn(final String name,final String fields,final String expression,final Boolean isLink,final Integer width,final boolean isOrderable,final boolean isSearchable){
  GridComponentColumn column=new GridComponentColumn(name);
  for (  FieldDefinition field : parseFields(fields,column)) {
    column.addField(field);
  }
  column.setExpression(expression);
  if (isLink != null) {
    column.setLink(isLink);
  }
  if (width != null) {
    column.setWidth(width);
  }
  columns.put(name,column);
  if (isOrderable) {
    orderableColumns.add(name);
  }
  if (isSearchable) {
    searchableColumns.add(name);
  }
}

Fixed version (ground truth):
public void addColumn(final String name,final String fields,final String expression,final Boolean isLink,final Integer width,final boolean isOrderable,final boolean isSearchable,final String extendingPluginIdentifier){
  final GridComponentColumn column=new GridComponentColumn(name,extendingPluginIdentifier);
  for (  FieldDefinition field : parseFields(fields,column)) {
    column.addField(field);
  }
  column.setExpression(expression);
  if (isLink != null) {
    column.setLink(isLink);
  }
  if (width != null) {
    column.setWidth(width);
  }
  columns.put(name,column);
  if (isOrderable) {
    orderableColumns.add(name);
  }
  if (isSearchable) {
    searchableColumns.add(name);
  }
}
Program: 39166
Project: 39166
Buggy source:
@Override public void enable(){
  GridComponentPattern grid=getGrid();
  for (  ViewGridColumnModuleColumnModel columnModel : columns) {
    grid.addColumn(columnModel.getName(),columnModel.getFields(),columnModel.getExpression(),columnModel.getLink(),columnModel.getWidth(),columnModel.getOrderable(),columnModel.getSearchable());
  }
}

Fixed version (ground truth):
@Override public void enable(){
  GridComponentPattern grid=getGrid();
  for (  ViewGridColumnModuleColumnModel columnModel : columns) {
    grid.addColumn(columnModel.getName(),columnModel.getFields(),columnModel.getExpression(),columnModel.getLink(),columnModel.getWidth(),columnModel.getOrderable(),columnModel.getSearchable(),pluginIdentifier);
  }
}
Program: 39167
Project: 39167
Buggy source:
private InternalDataDefinition resolveDataDefinitionFromClassType(final String classType){
  String[] tmp=classType.replaceAll("String_Node_Str","String_Node_Str").split("String_Node_Str");
  String model=tmp[1].replaceAll(tmp[0].substring(0,1).toUpperCase(Locale.ENGLISH) + tmp[0].substring(1),"String_Node_Str");
  model=model.substring(0,1).toLowerCase(Locale.ENGLISH) + model.substring(1);
  return (InternalDataDefinition)dataDefinitionService.get(tmp[0],model);
}

Fixed version (ground truth):
private InternalDataDefinition resolveDataDefinitionFromClassType(final String classType){
  String[] tmp=classType.replaceFirst("String_Node_Str","String_Node_Str").split("String_Node_Str");
  String model=tmp[1].replaceFirst(tmp[0].substring(0,1).toUpperCase(Locale.ENGLISH) + tmp[0].substring(1),"String_Node_Str");
  Preconditions.checkState(StringUtils.isNotBlank(model),"String_Node_Str");
  model=model.substring(0,1).toLowerCase(Locale.ENGLISH) + model.substring(1);
  return (InternalDataDefinition)dataDefinitionService.get(tmp[0],model);
}
Program: 39169
Project: 39169
Buggy source:
public LookupComponentState(final FieldDefinition scopeField,final String fieldCode,final String expression,final LookupComponentPattern pattern){
  super(pattern);
  this.belongsToFieldDefinition=scopeField;
  this.fieldCode=fieldCode;
  this.expression=expression;
  registerEvent("String_Node_Str",eventPerformer,"String_Node_Str");
  registerEvent("String_Node_Str",eventPerformer,"String_Node_Str");
  registerEvent("String_Node_Str",eventPerformer,"String_Node_Str");
}

Fixed version (ground truth):
public LookupComponentState(final FieldDefinition scopeField,final String fieldCode,final String expression,final LookupComponentPattern pattern){
  super(pattern);
  this.belongsToFieldDefinition=scopeField;
  this.fieldCode=fieldCode;
  this.expression=expression;
  this.criteriaModifier=pattern.getCriteriaModifier();
  registerEvent("String_Node_Str",eventPerformer,"String_Node_Str");
  registerEvent("String_Node_Str",eventPerformer,"String_Node_Str");
  registerEvent("String_Node_Str",eventPerformer,"String_Node_Str");
}
Program: 39170
Project: 39170
Buggy source:
public void removeTranslationKeysForPlugin(final String pluginIdentifier){
  customTranslationManagementService.removeCustomTranslations(pluginIdentifier);
}

Fixed version (ground truth):
public void removeTranslationKeysForPlugin(final String pluginIdentifier){
  customTranslationManagementService.removeCustomTranslations(pluginIdentifier);
  List<String> keys=customTranslationManagementService.getCustomTranslationKeys(pluginIdentifier);
  customTranslationCacheService.removeCustomTranslations(keys);
}
Program: 39171
Project: 39171
Buggy source:
@Override @Transactional @Monitorable public void disable(final String pluginIdentifier,final String name){
  SearchResult serachResult=dataDefinitionService.get(PLUGIN_IDENTIFIER,MODEL_DICTIONARY).find().add(SearchRestrictions.eq(NAME,name)).list();
  if (serachResult.getTotalNumberOfEntities() > 0) {
    Entity dictionaryEntity=serachResult.getEntities().get(0);
    dictionaryEntity.setField(ACTIVE,false);
    dataDefinitionService.get(PLUGIN_IDENTIFIER,MODEL_DICTIONARY).save(dictionaryEntity);
  }
}

Fixed version (ground truth):
@Override @Transactional @Monitorable public void disable(final String pluginIdentifier,final String name){
  final DataDefinition dictionaryDataDefinition=dataDefinitionService.get(QcadooModelConstants.PLUGIN_IDENTIFIER,QcadooModelConstants.MODEL_DICTIONARY);
  final SearchCriteriaBuilder searchCriteriaBuilder=dictionaryDataDefinition.find();
  searchCriteriaBuilder.add(SearchRestrictions.eq(DictionaryFields.NAME,name));
  searchCriteriaBuilder.add(SearchRestrictions.eq(DictionaryFields.ACTIVE,true));
  searchCriteriaBuilder.setMaxResults(1);
  final Entity dictionaryEntity=searchCriteriaBuilder.uniqueResult();
  if (dictionaryEntity != null) {
    dictionaryEntity.setField(DictionaryFields.ACTIVE,false);
    dictionaryDataDefinition.save(dictionaryEntity);
  }
}
Program: 39172
Project: 39172
Buggy source:
@Override public void multiTenantDisable(){
  super.multiTenantDisable();
}

Fixed version (ground truth):
@Override public void multiTenantDisable(){
}
Program: 39173
Project: 39173
Buggy source:
@Override public void multiTenantEnable(){
  super.multiTenantEnable();
}

Fixed version (ground truth):
@Override public void multiTenantEnable(){
}
Program: 39174
Project: 39174
Buggy source:
private Map<String,String> createDependenciesMap(final Map<String,String> arguments,final Locale locale){
  Map<String,String> dependencies=new HashMap<String,String>();
  for (  Map.Entry<String,String> arg : arguments.entrySet()) {
    if (arg.getKey().length() < 5) {
      continue;
    }
    if ("String_Node_Str".equals(arg.getKey().substring(0,4))) {
      if ("String_Node_Str".equals(arg.getValue())) {
        dependencies.put(arg.getKey().substring(4),null);
      }
 else {
        dependencies.put(arg.getKey().substring(4),convertVersionString(arg.getValue(),locale));
      }
    }
  }
  if (!dependencies.isEmpty()) {
    return dependencies;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
private Map<String,String> createDependenciesMap(final Map<String,String> arguments,final Locale locale){
  Map<String,String> dependencies=new HashMap<String,String>();
  for (  Map.Entry<String,String> arg : arguments.entrySet()) {
    if (arg.getKey().length() < 5) {
      continue;
    }
    if ("String_Node_Str".equals(arg.getKey().substring(0,4))) {
      if ("String_Node_Str".equals(arg.getValue())) {
        dependencies.put(arg.getKey().substring(4),null);
      }
 else {
        dependencies.put(arg.getKey().substring(4),convertVersionString(arg.getValue(),locale));
      }
    }
  }
  if (dependencies.isEmpty()) {
    return null;
  }
 else {
    return dependencies;
  }
}
Program: 39176
Project: 39176
Buggy source:
/** 
 * Update custom translation with given key, locale and customTranslation
 * @param key translation key
 * @param locale locale
 * @param customTranslation custom translation
 */
void updateCustomTranslation(final String key,final String locale,final String customTranslation);

Fixed version (ground truth):
/** 
 * Updates custom translation with given key, locale and customTranslation
 * @param key translation key
 * @param locale locale
 * @param customTranslation custom translation
 */
void updateCustomTranslation(final String key,final String locale,final String customTranslation);
Program: 39177
Project: 39177
Buggy source:
/** 
 * Add custom translation with given key, locale and customTranslation
 * @param key translation key
 * @param locale locale
 * @param customTranslation custom translation
 */
void addCustomTranslation(final String key,final String locale,final String customTranslation);

Fixed version (ground truth):
/** 
 * Adds custom translation with given key, locale and customTranslation
 * @param key translation key
 * @param locale locale
 * @param customTranslation custom translation
 */
void addCustomTranslation(final String key,final String locale,final String customTranslation);
Program: 39178
Project: 39178
Buggy source:
/** 
 * Gets list of custom translations with given locale
 * @param locale locale
 * @return the list of custom translations
 */
List<Entity> getCustomTranslations(final String locale);

Fixed version (ground truth):
/** 
 * Gets list of custom translations
 * @return the list of custom translations
 */
List<Entity> getCustomTranslations();
Program: 39179
Project: 39179
Buggy source:
/** 
 * Gets custom translation with given plugin identifier, key and locale
 * @param pluginIdentifier plugin identifier
 * @param key translation key
 * @param locale locale
 * @return the custom translation
 */
Entity getCustomTranslation(final String pluginIdentifier,final String key,final String locale);

Fixed version (ground truth):
/** 
 * Gets custom translation with given plugin identifier, locale and key
 * @param pluginIdentifier plugin identifier
 * @param key translation key
 * @param locale locale
 * @return the custom translation
 */
Entity getCustomTranslation(final String pluginIdentifier,final String key,final String locale);
Program: 39180
Project: 39180
Buggy source:
@Override public void updateCustomTranslation(final String key,final String locale,final String customTranslation){
  if (isCustomTranslationAdded(key)) {
    customTranslations.get(key).put(locale,customTranslation);
  }
}

Fixed version (ground truth):
@Override public void updateCustomTranslation(final String key,final String locale,final String customTranslation){
  if (isCustomTranslationAdded(key)) {
    getTenantCustomTranslationsCache().get(key).put(locale,customTranslation);
  }
}
Program: 39181
Project: 39181
Buggy source:
public CustomTranslationCacheServiceImpl(){
  this.customTranslations=Maps.newHashMap();
}

Fixed version (ground truth):
public CustomTranslationCacheServiceImpl(){
  this.customTranslationsCache=Maps.newHashMap();
}
Program: 39182
Project: 39182
Buggy source:
@Override public boolean isCustomTranslationActive(final String key,final String locale){
  if (customTranslations.containsKey(key)) {
    if (customTranslations.get(key).containsKey(locale)) {
      return customTranslations.get(key).get(locale) != null;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean isCustomTranslationActive(final String key,final String locale){
  if (getTenantCustomTranslationsCache().containsKey(key) && getTenantCustomTranslationsCache().get(key).containsKey(locale)) {
    return getTenantCustomTranslationsCache().get(key).get(locale) != null;
  }
  return false;
}
Program: 39183
Project: 39183
Buggy source:
@Override public boolean isCustomTranslationAdded(final String key){
  return customTranslations.containsKey(key);
}

Fixed version (ground truth):
@Override public boolean isCustomTranslationAdded(final String key){
  return getTenantCustomTranslationsCache().containsKey(key);
}
Program: 39184
Project: 39184
Buggy source:
@Override public Map<String,Map<String,String>> getCustomTranslations(){
  return customTranslations;
}

Fixed version (ground truth):
@Override public Map<String,Map<String,String>> getCustomTranslations(){
  return Collections.unmodifiableMap(getTenantCustomTranslationsCache());
}
Program: 39185
Project: 39185
Buggy source:
@Override public void addCustomTranslation(final String key,final String locale,final String customTranslation){
  Map<String,String> localeAndCustomTranslation=Maps.newHashMap();
  localeAndCustomTranslation.put(locale,customTranslation);
  customTranslations.put(key,localeAndCustomTranslation);
}

Fixed version (ground truth):
@Override public void addCustomTranslation(final String key,final String locale,final String customTranslation){
  Map<String,String> localeAndCustomTranslation=Maps.newHashMap();
  localeAndCustomTranslation.put(locale,customTranslation);
  getTenantCustomTranslationsCache().put(key,localeAndCustomTranslation);
}
Program: 39186
Project: 39186
Buggy source:
@Override public String getCustomTranslation(final String key,final String locale){
  if (customTranslations.containsKey(key)) {
    if (customTranslations.get(key).containsKey(locale)) {
      return customTranslations.get(key).get(locale);
    }
  }
  return null;
}

Fixed version (ground truth):
@Override public String getCustomTranslation(final String key,final String locale){
  if (getTenantCustomTranslationsCache().containsKey(key) && getTenantCustomTranslationsCache().get(key).containsKey(locale)) {
    return getTenantCustomTranslationsCache().get(key).get(locale);
  }
  return null;
}
Program: 39187
Project: 39187
Buggy source:
@Test public final void shouldReturnNonEmptyConversionsSetUsingSimpleBiDirectionalTraverse(){
  final Entity km_m=mockUnitConversionItem(BigDecimal.ONE,"String_Node_Str",BigDecimal.valueOf(1000L),"String_Node_Str");
  final Entity m_dm=mockUnitConversionItem(BigDecimal.ONE,"String_Node_Str",BigDecimal.valueOf(100L),"String_Node_Str");
  final Entity cm_mm=mockUnitConversionItem(BigDecimal.ONE,"String_Node_Str",BigDecimal.valueOf(10L),"String_Node_Str");
  stubGetAll(Lists.newArrayList(m_dm,km_m,cm_mm));
  final PossibleUnitConversions result=unitConversionService.getPossibleConversions("String_Node_Str");
  assertEquals(3,result.asUnitToConversionMap().size());
  assertBigDecimalEquals(new BigDecimal("String_Node_Str"),result.convertTo(BigDecimal.ONE,"String_Node_Str"));
  assertBigDecimalEquals(BigDecimal.valueOf(100L),result.convertTo(BigDecimal.ONE,"String_Node_Str"));
  assertBigDecimalEquals(BigDecimal.valueOf(1000L),result.convertTo(BigDecimal.ONE,"String_Node_Str"));
}

Fixed version (ground truth):
@Test public final void shouldReturnNonEmptyConversionsSetUsingSimpleBiDirectionalTraverse(){
  final Entity kmToM=mockUnitConversionItem(BigDecimal.ONE,"String_Node_Str",BigDecimal.valueOf(1000L),"String_Node_Str");
  final Entity mToDm=mockUnitConversionItem(BigDecimal.ONE,"String_Node_Str",BigDecimal.valueOf(100L),"String_Node_Str");
  final Entity cmToMm=mockUnitConversionItem(BigDecimal.ONE,"String_Node_Str",BigDecimal.valueOf(10L),"String_Node_Str");
  stubGetAll(Lists.newArrayList(mToDm,kmToM,cmToMm));
  final PossibleUnitConversions result=unitConversionService.getPossibleConversions("String_Node_Str");
  assertEquals(3,result.asUnitToConversionMap().size());
  assertBigDecimalEquals(new BigDecimal("String_Node_Str"),result.convertTo(BigDecimal.ONE,"String_Node_Str"));
  assertBigDecimalEquals(BigDecimal.valueOf(100L),result.convertTo(BigDecimal.ONE,"String_Node_Str"));
  assertBigDecimalEquals(BigDecimal.valueOf(1000L),result.convertTo(BigDecimal.ONE,"String_Node_Str"));
}