Program: 37010
Project: 37010
Buggy source:
@SuppressWarnings("String_Node_Str") public void testAnalyse(){
  ReportContext report=ReportFileReader.readSonargraphReport("String_Node_Str");
  assertNotNull(report);
  final RuleFinder ruleFinder=mock(RuleFinder.class);
  when(ruleFinder.findByKey(SonargraphPluginBase.PLUGIN_KEY,SonargraphPluginBase.TASK_RULE_KEY)).thenReturn(SonargraphRulesRepository.TASK);
  when(ruleFinder.findByKey(SonargraphPluginBase.PLUGIN_KEY,SonargraphPluginBase.CYCLE_GROUP_RULE_KEY)).thenReturn(SonargraphRulesRepository.CYCLE_GROUPS);
  when(ruleFinder.findByKey(SonargraphPluginBase.PLUGIN_KEY,SonargraphPluginBase.DUPLICATE_RULE_KEY)).thenReturn(SonargraphRulesRepository.DUPLICATES);
  when(ruleFinder.findByKey(SonargraphPluginBase.PLUGIN_KEY,SonargraphPluginBase.ARCH_RULE_KEY)).thenReturn(SonargraphRulesRepository.ARCH);
  when(ruleFinder.findByKey(SonargraphPluginBase.PLUGIN_KEY,SonargraphPluginBase.THRESHOLD_RULE_KEY)).thenReturn(SonargraphRulesRepository.THRESHOLD);
  when(ruleFinder.findByKey(SonargraphPluginBase.PLUGIN_KEY,SonargraphPluginBase.WORKSPACE_RULE_KEY)).thenReturn(SonargraphRulesRepository.WORKSPACE);
  final Configuration config=mock(Configuration.class);
  when(config.getString(any(String.class),any(String.class))).thenAnswer(new Answer<String>(){
    public String answer(    InvocationOnMock invocationOnMock) throws Throwable {
      return (String)invocationOnMock.getArguments()[1];
    }
  }
);
  SonargraphSensor sensor=new SonargraphSensor(ruleFinder,config);
  final SensorContext sensorContext=mock(SensorContext.class);
  when(sensorContext.getResource(any(Resource.class))).thenAnswer(new Answer(){
    public Object answer(    InvocationOnMock invocation){
      Object[] args=invocation.getArguments();
      return args[0];
    }
  }
);
  when(sensorContext.getMeasure(any(Metric.class))).thenAnswer(new Answer(){
    public Object answer(    InvocationOnMock invocation){
      Object arg=invocation.getArguments()[0];
      Measure result=new Measure((Metric)arg);
      result.setValue(0.0);
      return result;
    }
  }
);
  sensor.setSensorContext(sensorContext);
  final IProject project=mock(IProject.class);
  when(project.getConfiguration()).thenReturn(config);
  when(project.getKey()).thenReturn("String_Node_Str");
  when(project.getName()).thenReturn("String_Node_Str");
  XsdAttributeRoot buildUnit=sensor.retrieveBuildUnit(project.getKey(),report);
  assertNotNull(buildUnit);
  sensor.analyseBuildUnit(report,buildUnit);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public void testAnalyse(){
  ReportContext report=ReportFileReader.readSonargraphReport("String_Node_Str",true);
  assertNotNull(report);
  final RuleFinder ruleFinder=mock(RuleFinder.class);
  when(ruleFinder.findByKey(SonargraphPluginBase.PLUGIN_KEY,SonargraphPluginBase.TASK_RULE_KEY)).thenReturn(SonargraphRulesRepository.TASK);
  when(ruleFinder.findByKey(SonargraphPluginBase.PLUGIN_KEY,SonargraphPluginBase.CYCLE_GROUP_RULE_KEY)).thenReturn(SonargraphRulesRepository.CYCLE_GROUPS);
  when(ruleFinder.findByKey(SonargraphPluginBase.PLUGIN_KEY,SonargraphPluginBase.DUPLICATE_RULE_KEY)).thenReturn(SonargraphRulesRepository.DUPLICATES);
  when(ruleFinder.findByKey(SonargraphPluginBase.PLUGIN_KEY,SonargraphPluginBase.ARCH_RULE_KEY)).thenReturn(SonargraphRulesRepository.ARCH);
  when(ruleFinder.findByKey(SonargraphPluginBase.PLUGIN_KEY,SonargraphPluginBase.THRESHOLD_RULE_KEY)).thenReturn(SonargraphRulesRepository.THRESHOLD);
  when(ruleFinder.findByKey(SonargraphPluginBase.PLUGIN_KEY,SonargraphPluginBase.WORKSPACE_RULE_KEY)).thenReturn(SonargraphRulesRepository.WORKSPACE);
  final Configuration config=mock(Configuration.class);
  when(config.getString(any(String.class),any(String.class))).thenAnswer(new Answer<String>(){
    public String answer(    InvocationOnMock invocationOnMock) throws Throwable {
      return (String)invocationOnMock.getArguments()[1];
    }
  }
);
  SonargraphSensor sensor=new SonargraphSensor(ruleFinder,config);
  final SensorContext sensorContext=mock(SensorContext.class);
  when(sensorContext.getResource(any(Resource.class))).thenAnswer(new Answer(){
    public Object answer(    InvocationOnMock invocation){
      Object[] args=invocation.getArguments();
      return args[0];
    }
  }
);
  when(sensorContext.getMeasure(any(Metric.class))).thenAnswer(new Answer(){
    public Object answer(    InvocationOnMock invocation){
      Object arg=invocation.getArguments()[0];
      Measure result=new Measure((Metric)arg);
      result.setValue(0.0);
      return result;
    }
  }
);
  sensor.setSensorContext(sensorContext);
  final IProject project=mock(IProject.class);
  when(project.getConfiguration()).thenReturn(config);
  when(project.getKey()).thenReturn("String_Node_Str");
  when(project.getName()).thenReturn("String_Node_Str");
  XsdAttributeRoot buildUnit=sensor.retrieveBuildUnit(project.getKey(),report);
  assertNotNull(buildUnit);
  sensor.analyseBuildUnit(report,buildUnit);
}