Program: 13228
Project: 13228
Buggy source:
@Override protected void configure(){
  bind(Settings.class).toInstance(ImmutableSettings.EMPTY);
  OsService osService=mock(OsService.class);
  OsStats osStats=mock(OsStats.class);
  when(osService.stats()).thenReturn(osStats);
  when(osStats.loadAverage()).thenAnswer(new Answer<double[]>(){
    @Override public double[] answer(    InvocationOnMock invocation) throws Throwable {
      if (onWindows) {
        return new double[0];
      }
 else {
        return new double[]{1,5,15};
      }
    }
  }
);
  ByteSizeValue byteSizeValue=mock(ByteSizeValue.class);
  when(byteSizeValue.bytes()).thenReturn(12345342234L);
  when(byteSizeValue.toString()).thenReturn("String_Node_Str");
  OsStats.Mem mem=mock(OsStats.Mem.class);
  when(osStats.mem()).thenReturn(mem);
  when(mem.actualFree()).thenReturn(byteSizeValue);
  when(mem.actualUsed()).thenReturn(byteSizeValue);
  when(mem.usedPercent()).thenReturn((short)22);
  when(mem.freePercent()).thenReturn((short)78);
  bind(OsService.class).toInstance(osService);
  NodeService nodeService=mock(NodeService.class);
  NodeStats nodeStats=mock(NodeStats.class);
  when(nodeService.stats()).thenReturn(nodeStats);
  when(nodeStats.getHostname()).thenReturn("String_Node_Str");
  DiscoveryNode node=mock(DiscoveryNode.class);
  when(nodeStats.getNode()).thenReturn(node);
  when(nodeStats.getOs()).thenReturn(osStats);
  when(osStats.uptime()).thenReturn(new TimeValue(3600000));
  OsStats.Cpu cpu=mock(OsStats.Cpu.class);
  when(osStats.cpu()).thenReturn(cpu);
  when(cpu.sys()).thenReturn((short)2);
  when(cpu.user()).thenReturn((short)4);
  when(cpu.idle()).thenReturn((short)94);
  when(cpu.stolen()).thenReturn((short)10);
  ProcessStats processStats=mock(ProcessStats.class);
  when(nodeStats.getProcess()).thenReturn(processStats);
  when(processStats.getOpenFileDescriptors()).thenReturn(42L);
  NodeInfo nodeInfo=mock(NodeInfo.class);
  when(nodeService.info()).thenReturn(nodeInfo);
  ProcessInfo processInfo=mock(ProcessInfo.class);
  when(nodeInfo.getProcess()).thenReturn(processInfo);
  when(processInfo.getMaxFileDescriptors()).thenReturn(1000L);
  Discovery discovery=mock(Discovery.class);
  bind(Discovery.class).toInstance(discovery);
  when(discovery.localNode()).thenReturn(node);
  when(node.getId()).thenReturn("String_Node_Str");
  when(node.getName()).thenReturn("String_Node_Str");
  TransportAddress transportAddress=new InetSocketTransportAddress("String_Node_Str",44300);
  when(node.address()).thenReturn(transportAddress);
  NetworkStats.Tcp tcp=mock(NetworkStats.Tcp.class,new Answer<Long>(){
    @Override public Long answer(    InvocationOnMock invocation) throws Throwable {
      return 42L;
    }
  }
);
  NetworkStats networkStats=mock(NetworkStats.class);
  when(networkStats.tcp()).thenReturn(tcp);
  NetworkService networkService=mock(NetworkService.class);
  when(networkService.stats()).thenReturn(networkStats);
  bind(NetworkService.class).toInstance(networkService);
  bind(NodeService.class).toInstance(nodeService);
  NodeEnvironment nodeEnv=mock(NodeEnvironment.class);
  File[] dataLocations=new File[]{new File("String_Node_Str"),new File("String_Node_Str")};
  when(nodeEnv.hasNodeFile()).then(new Answer<Boolean>(){
    @Override public Boolean answer(    InvocationOnMock invocation) throws Throwable {
      return isDataNode;
    }
  }
);
  when(nodeEnv.nodeDataLocations()).thenReturn(dataLocations);
  bind(NodeEnvironment.class).toInstance(nodeEnv);
  Sigar sigar=mock(Sigar.class);
  SigarService sigarService=mock(SigarService.class);
  when(sigarService.sigarAvailable()).then(new Answer<Boolean>(){
    @Override public Boolean answer(    InvocationOnMock invocation) throws Throwable {
      return sigarAvailable;
    }
  }
);
  FileSystem fsFoo=mock(FileSystem.class);
  when(fsFoo.getDevName()).thenReturn("String_Node_Str");
  when(fsFoo.getDirName()).thenReturn("String_Node_Str");
  when(fsFoo.getType()).thenReturn(FileSystem.TYPE_LOCAL_DISK);
  FileSystem fsBar=mock(FileSystem.class);
  when(fsBar.getDevName()).thenReturn("String_Node_Str");
  when(fsBar.getDirName()).thenReturn("String_Node_Str");
  when(fsBar.getType()).thenReturn(FileSystem.TYPE_LOCAL_DISK);
  FileSystem fsFiltered=mock(FileSystem.class);
  when(fsFiltered.getType()).thenReturn(FileSystem.TYPE_UNKNOWN);
  when(fsFiltered.getDevName()).thenReturn(("String_Node_Str"));
  when(fsFiltered.getDirName()).thenReturn(("String_Node_Str"));
  FileSystemMap map=mock(FileSystemMap.class);
  when(map.getMountPoint("String_Node_Str")).thenReturn(fsFoo);
  when(map.getMountPoint("String_Node_Str")).thenReturn(fsBar);
  when(map.getMountPoint("String_Node_Str")).thenReturn(fsFiltered);
  FileSystemUsage usage=mock(FileSystemUsage.class,new Answer<Long>(){
    @Override public Long answer(    InvocationOnMock invocation) throws Throwable {
      return 42L;
    }
  }
);
  try {
    when(sigar.getFileSystemList()).thenReturn(new FileSystem[]{fsFoo,fsBar,fsFiltered});
    when(sigar.getFileSystemMap()).thenReturn(map);
    when(sigar.getFileSystemUsage(anyString())).thenReturn(usage);
    assertThat(sigar.getFileSystemUsage("String_Node_Str"),is(usage));
  }
 catch (  SigarException e) {
    e.printStackTrace();
  }
  when(sigarService.sigar()).thenReturn(sigar);
  bind(SigarService.class).toInstance(sigarService);
  try {
    assertThat(sigarService.sigar().getFileSystemMap(),is(map));
  }
 catch (  SigarException e) {
    e.printStackTrace();
  }
  HttpServer httpServer=mock(HttpServer.class);
  HttpInfo httpInfo=mock(HttpInfo.class);
  BoundTransportAddress boundTransportAddress=new BoundTransportAddress(new InetSocketTransportAddress("String_Node_Str",44200),new InetSocketTransportAddress("String_Node_Str",44200));
  when(httpInfo.address()).thenReturn(boundTransportAddress);
  when(httpServer.info()).thenReturn(httpInfo);
  bind(HttpServer.class).toInstance(httpServer);
  JvmService jvmService=mock(JvmService.class);
  JvmStats jvmStats=mock(JvmStats.class);
  JvmStats.Mem jvmStatsMem=mock(JvmStats.Mem.class);
  ByteSizeValue heapByteSizeValueMax=mock(ByteSizeValue.class);
  when(heapByteSizeValueMax.bytes()).thenReturn(123456L);
  when(jvmStatsMem.getHeapMax()).thenReturn(heapByteSizeValueMax);
  when(jvmStatsMem.getHeapUsed()).thenReturn(heapByteSizeValueMax);
  when(jvmStats.mem()).thenReturn(jvmStatsMem);
  when(jvmService.stats()).thenReturn(jvmStats);
  bind(JvmService.class).toInstance(jvmService);
  bind(ReferenceResolver.class).to(GlobalReferenceResolver.class).asEagerSingleton();
  ThreadPool threadPool=new ThreadPool(getClass().getName());
  bind(ThreadPool.class).toInstance(threadPool);
}

Fixed version (ground truth):
@Override protected void configure(){
  bind(Settings.class).toInstance(ImmutableSettings.EMPTY);
  OsService osService=mock(OsService.class);
  OsStats osStats=mock(OsStats.class);
  when(osService.stats()).thenReturn(osStats);
  when(osStats.loadAverage()).thenAnswer(new Answer<double[]>(){
    @Override public double[] answer(    InvocationOnMock invocation) throws Throwable {
      if (onWindows) {
        return new double[0];
      }
 else {
        return new double[]{1,5,15};
      }
    }
  }
);
  ByteSizeValue byteSizeValue=mock(ByteSizeValue.class);
  when(byteSizeValue.bytes()).thenReturn(12345342234L);
  when(byteSizeValue.toString()).thenReturn("String_Node_Str");
  OsStats.Mem mem=mock(OsStats.Mem.class);
  when(osStats.mem()).thenReturn(mem);
  when(mem.actualFree()).thenReturn(byteSizeValue);
  when(mem.actualUsed()).thenReturn(byteSizeValue);
  when(mem.usedPercent()).thenReturn((short)22);
  when(mem.freePercent()).thenReturn((short)78);
  bind(OsService.class).toInstance(osService);
  NodeService nodeService=mock(NodeService.class);
  NodeStats nodeStats=mock(NodeStats.class);
  when(nodeService.stats()).thenReturn(nodeStats);
  when(nodeStats.getHostname()).thenReturn("String_Node_Str");
  DiscoveryNode node=mock(DiscoveryNode.class);
  when(nodeStats.getNode()).thenReturn(node);
  when(nodeStats.getOs()).thenReturn(osStats);
  when(osStats.uptime()).thenReturn(new TimeValue(3600000));
  OsStats.Cpu cpu=mock(OsStats.Cpu.class);
  when(osStats.cpu()).thenReturn(cpu);
  when(cpu.sys()).thenReturn((short)2);
  when(cpu.user()).thenReturn((short)4);
  when(cpu.idle()).thenReturn((short)94);
  when(cpu.stolen()).thenReturn((short)10);
  ProcessStats processStats=mock(ProcessStats.class);
  when(nodeStats.getProcess()).thenReturn(processStats);
  when(processStats.getOpenFileDescriptors()).thenReturn(42L);
  NodeInfo nodeInfo=mock(NodeInfo.class);
  when(nodeService.info()).thenReturn(nodeInfo);
  ProcessInfo processInfo=mock(ProcessInfo.class);
  when(nodeInfo.getProcess()).thenReturn(processInfo);
  when(processInfo.getMaxFileDescriptors()).thenReturn(1000L);
  Discovery discovery=mock(Discovery.class);
  bind(Discovery.class).toInstance(discovery);
  when(discovery.localNode()).thenReturn(node);
  when(node.getId()).thenReturn("String_Node_Str");
  when(node.getName()).thenReturn("String_Node_Str");
  TransportAddress transportAddress=new InetSocketTransportAddress("String_Node_Str",44300);
  when(node.address()).thenReturn(transportAddress);
  NetworkStats.Tcp tcp=mock(NetworkStats.Tcp.class,new Answer<Long>(){
    @Override public Long answer(    InvocationOnMock invocation) throws Throwable {
      return 42L;
    }
  }
);
  NetworkStats networkStats=mock(NetworkStats.class);
  when(networkStats.tcp()).thenReturn(tcp);
  NetworkService networkService=mock(NetworkService.class);
  when(networkService.stats()).thenReturn(networkStats);
  bind(NetworkService.class).toInstance(networkService);
  bind(NodeService.class).toInstance(nodeService);
  NodeEnvironment nodeEnv=mock(NodeEnvironment.class);
  File[] dataLocations=new File[]{new File("String_Node_Str"),new File("String_Node_Str")};
  when(nodeEnv.hasNodeFile()).then(new Answer<Boolean>(){
    @Override public Boolean answer(    InvocationOnMock invocation) throws Throwable {
      return isDataNode;
    }
  }
);
  when(nodeEnv.nodeDataLocations()).thenReturn(dataLocations);
  bind(NodeEnvironment.class).toInstance(nodeEnv);
  Sigar sigar=mock(Sigar.class);
  SigarService sigarService=mock(SigarService.class);
  when(sigarService.sigarAvailable()).then(new Answer<Boolean>(){
    @Override public Boolean answer(    InvocationOnMock invocation) throws Throwable {
      return sigarAvailable;
    }
  }
);
  FileSystem fsFoo=mock(FileSystem.class);
  when(fsFoo.getDevName()).thenReturn("String_Node_Str");
  when(fsFoo.getDirName()).thenReturn("String_Node_Str");
  when(fsFoo.getType()).thenReturn(FileSystem.TYPE_LOCAL_DISK);
  FileSystem fsBar=mock(FileSystem.class);
  when(fsBar.getDevName()).thenReturn("String_Node_Str");
  when(fsBar.getDirName()).thenReturn("String_Node_Str");
  when(fsBar.getType()).thenReturn(FileSystem.TYPE_LOCAL_DISK);
  FileSystem fsFiltered=mock(FileSystem.class);
  when(fsFiltered.getType()).thenReturn(FileSystem.TYPE_UNKNOWN);
  when(fsFiltered.getDevName()).thenReturn(("String_Node_Str"));
  when(fsFiltered.getDirName()).thenReturn(("String_Node_Str"));
  FileSystemMap map=mock(FileSystemMap.class);
  when(map.getMountPoint("String_Node_Str")).thenReturn(fsFoo);
  when(map.getMountPoint("String_Node_Str")).thenReturn(fsBar);
  when(map.getMountPoint("String_Node_Str")).thenReturn(fsFiltered);
  FileSystemUsage usage=mock(FileSystemUsage.class,new Answer<Long>(){
    @Override public Long answer(    InvocationOnMock invocation) throws Throwable {
      return 42L;
    }
  }
);
  try {
    when(sigar.getFileSystemList()).thenReturn(new FileSystem[]{fsFoo,fsBar,fsFiltered});
    when(sigar.getFileSystemMap()).thenReturn(map);
    when(sigar.getFileSystemUsage(anyString())).thenReturn(usage);
    assertThat(sigar.getFileSystemUsage("String_Node_Str"),is(usage));
  }
 catch (  SigarException e) {
    e.printStackTrace();
  }
  when(sigarService.sigar()).thenReturn(sigar);
  bind(SigarService.class).toInstance(sigarService);
  try {
    assertThat(sigarService.sigar().getFileSystemMap(),is(map));
  }
 catch (  SigarException e) {
    e.printStackTrace();
  }
  HttpInfo httpInfo=mock(HttpInfo.class);
  when(nodeInfo.getHttp()).thenReturn(httpInfo);
  BoundTransportAddress boundTransportAddress=new BoundTransportAddress(new InetSocketTransportAddress("String_Node_Str",44200),new InetSocketTransportAddress("String_Node_Str",44200));
  when(httpInfo.address()).thenReturn(boundTransportAddress);
  JvmService jvmService=mock(JvmService.class);
  JvmStats jvmStats=mock(JvmStats.class);
  JvmStats.Mem jvmStatsMem=mock(JvmStats.Mem.class);
  ByteSizeValue heapByteSizeValueMax=mock(ByteSizeValue.class);
  when(heapByteSizeValueMax.bytes()).thenReturn(123456L);
  when(jvmStatsMem.getHeapMax()).thenReturn(heapByteSizeValueMax);
  when(jvmStatsMem.getHeapUsed()).thenReturn(heapByteSizeValueMax);
  when(jvmStats.mem()).thenReturn(jvmStatsMem);
  when(jvmService.stats()).thenReturn(jvmStats);
  bind(JvmService.class).toInstance(jvmService);
  bind(ReferenceResolver.class).to(GlobalReferenceResolver.class).asEagerSingleton();
  ThreadPool threadPool=new ThreadPool(getClass().getName());
  bind(ThreadPool.class).toInstance(threadPool);
}