use of com.facebook.buck.rules.keys.RuleKeyFactory in project buck by facebook.
the class RuleKeyTest method subclassWithNoopSetter.
@Test
public void subclassWithNoopSetter() {
class NoopSetterRuleKeyBuilder extends UncachedRuleKeyBuilder {
public NoopSetterRuleKeyBuilder(SourcePathRuleFinder ruleFinder, SourcePathResolver pathResolver, FileHashCache hashCache, RuleKeyFactory<RuleKey> defaultRuleKeyFactory) {
super(ruleFinder, pathResolver, hashCache, defaultRuleKeyFactory);
}
@Override
protected NoopSetterRuleKeyBuilder setSourcePath(SourcePath sourcePath) {
return this;
}
}
SourcePathRuleFinder ruleFinder = new SourcePathRuleFinder(new BuildRuleResolver(TargetGraph.EMPTY, new DefaultTargetNodeToBuildRuleTransformer()));
SourcePathResolver pathResolver = new SourcePathResolver(ruleFinder);
FileHashCache hashCache = new FakeFileHashCache(ImmutableMap.of());
RuleKeyFactory<RuleKey> ruleKeyFactory = new DefaultRuleKeyFactory(0, hashCache, pathResolver, ruleFinder);
RuleKey nullRuleKey = new NoopSetterRuleKeyBuilder(ruleFinder, pathResolver, hashCache, ruleKeyFactory).build();
RuleKey noopRuleKey = new NoopSetterRuleKeyBuilder(ruleFinder, pathResolver, hashCache, ruleKeyFactory).setReflectively("key", new FakeSourcePath("value")).build();
assertThat(noopRuleKey, is(equalTo(nullRuleKey)));
}
Aggregations