@Test
  public void findDepsFromParamsDoesNothingForUnflavoredTarget() {
    BuildTarget unflavoredTarget = BuildTargetFactory.newInstance("//:thrift");

    // Setup an empty thrift buck config and description.
    FakeBuckConfig buckConfig = new FakeBuckConfig();
    ThriftBuckConfig thriftBuckConfig = new ThriftBuckConfig(buckConfig);
    ThriftLibraryDescription desc =
        new ThriftLibraryDescription(
            thriftBuckConfig, ImmutableList.<ThriftLanguageSpecificEnhancer>of());

    ThriftConstructorArg constructorArg = desc.createUnpopulatedConstructorArg();

    // Now call the find deps methods and verify it returns nothing.
    Iterable<BuildTarget> results =
        desc.findDepsForTargetFromConstructorArgs(unflavoredTarget, constructorArg);
    assertEquals(ImmutableList.<BuildTarget>of(), ImmutableList.copyOf(results));
  }
  @Test
  public void findDepsFromParamsSetsUpDepsForFlavoredTarget() {
    // Create the thrift target and implicit dep.
    BuildTarget thriftTarget = BuildTargetFactory.newInstance("//bar:thrift_compiler");
    FakeBuildRule implicitDep =
        createFakeBuildRule("//foo:implicit_dep", new SourcePathResolver(new BuildRuleResolver()));

    // Setup the default values returned by the language specific enhancer.
    String language = "fake";
    Flavor flavor = ImmutableFlavor.of("fake");
    ImmutableSet<String> options = ImmutableSet.of();
    ImmutableSet<BuildTarget> implicitDeps = ImmutableSet.of(implicitDep.getBuildTarget());
    BuildTarget unflavoredTarget = BuildTargetFactory.newInstance("//:thrift");
    BuildTarget flavoredTarget =
        BuildTargets.createFlavoredBuildTarget(unflavoredTarget.checkUnflavored(), flavor);

    // Setup an empty thrift buck config and description.
    FakeBuckConfig buckConfig =
        new FakeBuckConfig(
            ImmutableMap.of("thrift", ImmutableMap.of("compiler", thriftTarget.toString())));
    ThriftBuckConfig thriftBuckConfig = new ThriftBuckConfig(buckConfig);
    ThriftLanguageSpecificEnhancer enhancer =
        new FakeThriftLanguageSpecificEnhancer(language, flavor, implicitDeps, options);
    ThriftLibraryDescription desc =
        new ThriftLibraryDescription(thriftBuckConfig, ImmutableList.of(enhancer));

    ThriftConstructorArg constructorArg = desc.createUnpopulatedConstructorArg();
    constructorArg.deps = Optional.of(ImmutableSortedSet.<BuildTarget>of());

    // Now call the find deps methods and verify it returns nothing.
    Iterable<BuildTarget> results =
        desc.findDepsForTargetFromConstructorArgs(flavoredTarget, constructorArg);
    assertEquals(
        ImmutableSet.<BuildTarget>builder()
            .add(unflavoredTarget)
            .add(thriftTarget)
            .addAll(implicitDeps)
            .build(),
        ImmutableSet.copyOf(results));
  }