Program: 92271
Project: 92271
Buggy source:
/** 
 * Tests the   {@link RangeFormat#format(Object,StringBuffer,FieldPosition)} method with numbers.
 */
@Test public void testFormatNumbers(){
  format=new RangeFormat(Locale.CANADA);
  minPos=new FieldPosition(RangeFormat.Field.MIN_VALUE);
  maxPos=new FieldPosition(RangeFormat.Field.MAX_VALUE);
  assertEquals("String_Node_Str",format(NumberRange.create(-10,true,20,true)));
  assertEquals("String_Node_Str",1,minPos.getBeginIndex());
  assertEquals("String_Node_Str",4,minPos.getEndIndex());
  assertEquals("String_Node_Str",7,maxPos.getBeginIndex());
  assertEquals("String_Node_Str",9,maxPos.getEndIndex());
  assertEquals("String_Node_Str",format(NumberRange.create(-3,false,4,false)));
  assertEquals("String_Node_Str",1,minPos.getBeginIndex());
  assertEquals("String_Node_Str",3,minPos.getEndIndex());
  assertEquals("String_Node_Str",6,maxPos.getBeginIndex());
  assertEquals("String_Node_Str",7,maxPos.getEndIndex());
  assertEquals("String_Node_Str",format(NumberRange.create(2,true,8,false)));
  assertEquals("String_Node_Str",1,minPos.getBeginIndex());
  assertEquals("String_Node_Str",2,minPos.getEndIndex());
  assertEquals("String_Node_Str",5,maxPos.getBeginIndex());
  assertEquals("String_Node_Str",6,maxPos.getEndIndex());
  assertEquals("String_Node_Str",format(NumberRange.create(40,false,90,true)));
  assertEquals("String_Node_Str",1,minPos.getBeginIndex());
  assertEquals("String_Node_Str",3,minPos.getEndIndex());
  assertEquals("String_Node_Str",6,maxPos.getBeginIndex());
  assertEquals("String_Node_Str",8,maxPos.getEndIndex());
  assertEquals("String_Node_Str",format(NumberRange.create(300,true,300,true)));
  assertEquals("String_Node_Str",1,minPos.getBeginIndex());
  assertEquals("String_Node_Str",4,minPos.getEndIndex());
  assertEquals("String_Node_Str",1,maxPos.getBeginIndex());
  assertEquals("String_Node_Str",4,maxPos.getEndIndex());
  assertEquals("String_Node_Str",format(NumberRange.create(300,true,300,false)));
  assertEquals("String_Node_Str",1,minPos.getBeginIndex());
  assertEquals("String_Node_Str",1,minPos.getEndIndex());
  assertEquals("String_Node_Str",1,maxPos.getBeginIndex());
  assertEquals("String_Node_Str",1,maxPos.getEndIndex());
  assertEquals("String_Node_Str",format(NumberRange.create(Double.NEGATIVE_INFINITY,true,30,true)));
  assertEquals("String_Node_Str",1,minPos.getBeginIndex());
  assertEquals("String_Node_Str",3,minPos.getEndIndex());
  assertEquals("String_Node_Str",6,maxPos.getBeginIndex());
  assertEquals("String_Node_Str",8,maxPos.getEndIndex());
  assertEquals("String_Node_Str",format(NumberRange.create(50,true,Double.POSITIVE_INFINITY,true)));
  assertEquals("String_Node_Str",1,minPos.getBeginIndex());
  assertEquals("String_Node_Str",3,minPos.getEndIndex());
  assertEquals("String_Node_Str",6,maxPos.getBeginIndex());
  assertEquals("String_Node_Str",7,maxPos.getEndIndex());
  assertEquals("String_Node_Str",format(NumberRange.create(Double.NEGATIVE_INFINITY,true,Double.POSITIVE_INFINITY,true)));
  assertEquals("String_Node_Str",1,minPos.getBeginIndex());
  assertEquals("String_Node_Str",3,minPos.getEndIndex());
  assertEquals("String_Node_Str",6,maxPos.getBeginIndex());
  assertEquals("String_Node_Str",7,maxPos.getEndIndex());
  assertEquals("String_Node_Str",format(new NumberRange<>(Integer.class,50,true,null,true)));
  assertEquals("String_Node_Str",1,minPos.getBeginIndex());
  assertEquals("String_Node_Str",3,minPos.getEndIndex());
  assertEquals("String_Node_Str",6,maxPos.getBeginIndex());
  assertEquals("String_Node_Str",7,maxPos.getEndIndex());
  assertEquals("String_Node_Str",format(new NumberRange<>(Integer.class,null,true,40,true)));
  assertEquals("String_Node_Str",1,minPos.getBeginIndex());
  assertEquals("String_Node_Str",3,minPos.getEndIndex());
  assertEquals("String_Node_Str",6,maxPos.getBeginIndex());
  assertEquals("String_Node_Str",8,maxPos.getEndIndex());
  assertEquals("String_Node_Str",format(MeasurementRange.create(-10,true,20,true,SI.METRE)));
  assertEquals("String_Node_Str",1,minPos.getBeginIndex());
  assertEquals("String_Node_Str",4,minPos.getEndIndex());
  assertEquals("String_Node_Str",7,maxPos.getBeginIndex());
  assertEquals("String_Node_Str",9,maxPos.getEndIndex());
  assertEquals("String_Node_Str",format(MeasurementRange.create(-10,true,20,true,NonSI.DEGREE_ANGLE)));
  assertEquals("String_Node_Str",1,minPos.getBeginIndex());
  assertEquals("String_Node_Str",4,minPos.getEndIndex());
  assertEquals("String_Node_Str",7,maxPos.getBeginIndex());
  assertEquals("String_Node_Str",9,maxPos.getEndIndex());
  maxPos=new FieldPosition(RangeFormat.Field.UNIT);
  assertEquals("String_Node_Str",format(MeasurementRange.create(-1,true,2,true,SI.KILOMETRE)));
  assertEquals("String_Node_Str",9,maxPos.getBeginIndex());
  assertEquals("String_Node_Str",11,maxPos.getEndIndex());
}

Fixed version (ground truth):
/** 
 * Tests the   {@link RangeFormat#format(Object,StringBuffer,FieldPosition)} method with numbers.
 */
@Test public void testFormatNumbers(){
  format=new RangeFormat(Locale.CANADA);
  minPos=new FieldPosition(RangeFormat.Field.MIN_VALUE);
  maxPos=new FieldPosition(RangeFormat.Field.MAX_VALUE);
  assertEquals("String_Node_Str",format(NumberRange.create(-10,true,20,true)));
  assertEquals("String_Node_Str",1,minPos.getBeginIndex());
  assertEquals("String_Node_Str",4,minPos.getEndIndex());
  assertEquals("String_Node_Str",7,maxPos.getBeginIndex());
  assertEquals("String_Node_Str",9,maxPos.getEndIndex());
  assertEquals("String_Node_Str",format(NumberRange.create(-3,false,4,false)));
  assertEquals("String_Node_Str",1,minPos.getBeginIndex());
  assertEquals("String_Node_Str",3,minPos.getEndIndex());
  assertEquals("String_Node_Str",6,maxPos.getBeginIndex());
  assertEquals("String_Node_Str",7,maxPos.getEndIndex());
  assertEquals("String_Node_Str",format(NumberRange.create(2,true,8,false)));
  assertEquals("String_Node_Str",1,minPos.getBeginIndex());
  assertEquals("String_Node_Str",2,minPos.getEndIndex());
  assertEquals("String_Node_Str",5,maxPos.getBeginIndex());
  assertEquals("String_Node_Str",6,maxPos.getEndIndex());
  assertEquals("String_Node_Str",format(NumberRange.create(40,false,90,true)));
  assertEquals("String_Node_Str",1,minPos.getBeginIndex());
  assertEquals("String_Node_Str",3,minPos.getEndIndex());
  assertEquals("String_Node_Str",6,maxPos.getBeginIndex());
  assertEquals("String_Node_Str",8,maxPos.getEndIndex());
  assertEquals("String_Node_Str",format(NumberRange.create(300,true,300,true)));
  assertEquals("String_Node_Str",1,minPos.getBeginIndex());
  assertEquals("String_Node_Str",4,minPos.getEndIndex());
  assertEquals("String_Node_Str",1,maxPos.getBeginIndex());
  assertEquals("String_Node_Str",4,maxPos.getEndIndex());
  assertEquals("String_Node_Str",format(NumberRange.create(300,true,300,false)));
  assertEquals("String_Node_Str",1,minPos.getBeginIndex());
  assertEquals("String_Node_Str",1,minPos.getEndIndex());
  assertEquals("String_Node_Str",1,maxPos.getBeginIndex());
  assertEquals("String_Node_Str",1,maxPos.getEndIndex());
  assertEquals("String_Node_Str",format(NumberRange.create(Double.NEGATIVE_INFINITY,true,30,true)));
  assertEquals("String_Node_Str",1,minPos.getBeginIndex());
  assertEquals("String_Node_Str",3,minPos.getEndIndex());
  assertEquals("String_Node_Str",6,maxPos.getBeginIndex());
  assertEquals("String_Node_Str",8,maxPos.getEndIndex());
  assertEquals("String_Node_Str",format(NumberRange.create(50,true,Double.POSITIVE_INFINITY,true)));
  assertEquals("String_Node_Str",1,minPos.getBeginIndex());
  assertEquals("String_Node_Str",3,minPos.getEndIndex());
  assertEquals("String_Node_Str",6,maxPos.getBeginIndex());
  assertEquals("String_Node_Str",7,maxPos.getEndIndex());
  assertEquals("String_Node_Str",format(NumberRange.create(Double.NEGATIVE_INFINITY,true,Double.POSITIVE_INFINITY,true)));
  assertEquals("String_Node_Str",1,minPos.getBeginIndex());
  assertEquals("String_Node_Str",3,minPos.getEndIndex());
  assertEquals("String_Node_Str",6,maxPos.getBeginIndex());
  assertEquals("String_Node_Str",7,maxPos.getEndIndex());
  assertEquals("String_Node_Str",format(new NumberRange<Integer>(Integer.class,50,true,null,true)));
  assertEquals("String_Node_Str",1,minPos.getBeginIndex());
  assertEquals("String_Node_Str",3,minPos.getEndIndex());
  assertEquals("String_Node_Str",6,maxPos.getBeginIndex());
  assertEquals("String_Node_Str",7,maxPos.getEndIndex());
  assertEquals("String_Node_Str",format(new NumberRange<Integer>(Integer.class,null,true,40,true)));
  assertEquals("String_Node_Str",1,minPos.getBeginIndex());
  assertEquals("String_Node_Str",3,minPos.getEndIndex());
  assertEquals("String_Node_Str",6,maxPos.getBeginIndex());
  assertEquals("String_Node_Str",8,maxPos.getEndIndex());
  assertEquals("String_Node_Str",format(MeasurementRange.create(-10,true,20,true,SI.METRE)));
  assertEquals("String_Node_Str",1,minPos.getBeginIndex());
  assertEquals("String_Node_Str",4,minPos.getEndIndex());
  assertEquals("String_Node_Str",7,maxPos.getBeginIndex());
  assertEquals("String_Node_Str",9,maxPos.getEndIndex());
  assertEquals("String_Node_Str",format(MeasurementRange.create(-10,true,20,true,NonSI.DEGREE_ANGLE)));
  assertEquals("String_Node_Str",1,minPos.getBeginIndex());
  assertEquals("String_Node_Str",4,minPos.getEndIndex());
  assertEquals("String_Node_Str",7,maxPos.getBeginIndex());
  assertEquals("String_Node_Str",9,maxPos.getEndIndex());
  maxPos=new FieldPosition(RangeFormat.Field.UNIT);
  assertEquals("String_Node_Str",format(MeasurementRange.create(-1,true,2,true,SI.KILOMETRE)));
  assertEquals("String_Node_Str",9,maxPos.getBeginIndex());
  assertEquals("String_Node_Str",11,maxPos.getEndIndex());
}