Program: 53187
Project: 53187
Buggy source:
@Test public void staticLinkage(){
  BuildRuleResolver ruleResolver=new BuildRuleResolver();
  SourcePathResolver pathResolver=new SourcePathResolver(ruleResolver);
  BuildTarget target=BuildTargetFactory.newInstance("String_Node_Str");
  BuildRuleParams params=BuildRuleParamsFactory.createTrivialBuildRuleParams(target);
  CxxPlatform cxxPlatform=DefaultCxxPlatforms.build(new CxxBuckConfig(new FakeBuckConfig()));
  BuildTarget staticPicLibraryTarget=BuildTarget.builder(params.getBuildTarget()).addFlavors(cxxPlatform.getFlavor(),CxxDescriptionEnhancer.STATIC_PIC_FLAVOR).build();
  ruleResolver.addToIndex(new FakeBuildRule(BuildRuleParamsFactory.createTrivialBuildRuleParams(staticPicLibraryTarget),pathResolver));
  CxxLibrary cxxLibrary=new CxxLibrary(params,ruleResolver,pathResolver,Predicates.<CxxPlatform>alwaysFalse(),Functions.constant(ImmutableMultimap.<CxxSource.Type,String>of()),Functions.constant(ImmutableList.<String>of()),Optional.<Pattern>absent(),Functions.constant(ImmutableSet.<Path>of()),CxxLibrary.Linkage.STATIC,false,Optional.<String>absent(),ImmutableSortedSet.<BuildTarget>of());
  assertThat(cxxLibrary.getSharedLibraries(cxxPlatform).entrySet(),Matchers.empty());
  assertThat(cxxLibrary.getPythonPackageComponents(cxxPlatform).getNativeLibraries().entrySet(),Matchers.empty());
  NativeLinkableInput expectedSharedNativeLinkableInput=NativeLinkableInput.of(ImmutableList.<SourcePath>of(new BuildTargetSourcePath(staticPicLibraryTarget)),ImmutableList.of(CxxDescriptionEnhancer.getStaticLibraryPath(target,cxxPlatform.getFlavor(),CxxSourceRuleFactory.PicType.PIC).toString()),ImmutableSet.<Path>of());
  assertEquals(expectedSharedNativeLinkableInput,cxxLibrary.getNativeLinkableInput(cxxPlatform,Linker.LinkableDepType.SHARED));
}

Fixed version (ground truth):
@Test public void staticLinkage(){
  BuildRuleResolver ruleResolver=new BuildRuleResolver();
  SourcePathResolver pathResolver=new SourcePathResolver(ruleResolver);
  BuildTarget target=BuildTargetFactory.newInstance("String_Node_Str");
  BuildRuleParams params=BuildRuleParamsFactory.createTrivialBuildRuleParams(target);
  CxxPlatform cxxPlatform=DefaultCxxPlatforms.build(new CxxBuckConfig(new FakeBuckConfig()));
  BuildTarget staticPicLibraryTarget=BuildTarget.builder(params.getBuildTarget()).addFlavors(cxxPlatform.getFlavor(),CxxDescriptionEnhancer.STATIC_PIC_FLAVOR).build();
  ruleResolver.addToIndex(new FakeBuildRule(BuildRuleParamsFactory.createTrivialBuildRuleParams(staticPicLibraryTarget),pathResolver));
  CxxLibrary cxxLibrary=new CxxLibrary(params,ruleResolver,pathResolver,Predicates.<CxxPlatform>alwaysFalse(),Functions.constant(ImmutableMultimap.<CxxSource.Type,String>of()),Functions.constant(ImmutableList.<String>of()),Optional.<Pattern>absent(),Functions.constant(ImmutableSet.<Path>of()),NativeLinkable.Linkage.STATIC,false,Optional.<String>absent(),ImmutableSortedSet.<BuildTarget>of());
  assertThat(cxxLibrary.getSharedLibraries(cxxPlatform).entrySet(),Matchers.empty());
  assertThat(cxxLibrary.getPythonPackageComponents(cxxPlatform).getNativeLibraries().entrySet(),Matchers.empty());
  NativeLinkableInput expectedSharedNativeLinkableInput=NativeLinkableInput.of(ImmutableList.<SourcePath>of(new BuildTargetSourcePath(staticPicLibraryTarget)),ImmutableList.of(CxxDescriptionEnhancer.getStaticLibraryPath(target,cxxPlatform.getFlavor(),CxxSourceRuleFactory.PicType.PIC).toString()),ImmutableSet.<Path>of());
  assertEquals(expectedSharedNativeLinkableInput,cxxLibrary.getNativeLinkableInput(cxxPlatform,Linker.LinkableDepType.SHARED));
}