use of com.google.devtools.build.skyframe.CyclesReporter.SingleCycleReporter in project bazel by bazelbuild.
the class CyclesReporterTest method smoke.
@Test
public void smoke() {
final AtomicBoolean reported = new AtomicBoolean();
SingleCycleReporter singleReporter = new SingleCycleReporter() {
@Override
public boolean maybeReportCycle(SkyKey topLevelKey, CycleInfo cycleInfo, boolean alreadyReported, ExtendedEventHandler eventHandler) {
reported.set(true);
return true;
}
};
CycleInfo cycleInfo = new CycleInfo(ImmutableList.of(DUMMY_KEY));
CyclesReporter cyclesReporter = new CyclesReporter(singleReporter);
cyclesReporter.reportCycles(ImmutableList.of(cycleInfo), DUMMY_KEY, NullEventHandler.INSTANCE);
assertThat(reported.get()).isTrue();
}
use of com.google.devtools.build.skyframe.CyclesReporter.SingleCycleReporter in project bazel by bazelbuild.
the class CyclesReporterTest method notReportedAssertion.
@Test
public void notReportedAssertion() {
SingleCycleReporter singleReporter = new SingleCycleReporter() {
@Override
public boolean maybeReportCycle(SkyKey topLevelKey, CycleInfo cycleInfo, boolean alreadyReported, ExtendedEventHandler eventHandler) {
return false;
}
};
CycleInfo cycleInfo = new CycleInfo(ImmutableList.of(DUMMY_KEY));
CyclesReporter cyclesReporter = new CyclesReporter(singleReporter);
try {
cyclesReporter.reportCycles(ImmutableList.of(cycleInfo), DUMMY_KEY, NullEventHandler.INSTANCE);
assertThat(false).isTrue();
} catch (IllegalStateException e) {
// Expected.
}
}
Aggregations