use of com.google.idea.blaze.base.dependencies.TargetInfo in project intellij by bazelbuild.
the class RuleNameHeuristicTest method testPredicateNotMatchingForPartialOverlap.
@Test
public void testPredicateNotMatchingForPartialOverlap() throws Exception {
File source = new File("java/com/foo/BarFooTest.java");
TargetInfo target = TargetIdeInfo.builder().setLabel("//foo:FooTest").setKind("java_test").build().toTargetInfo();
assertThat(new TargetNameHeuristic().matchesSource(project, target, null, source, null)).isFalse();
}
use of com.google.idea.blaze.base.dependencies.TargetInfo in project intellij by bazelbuild.
the class RuleNameHeuristicTest method testFilterChoosesFirstMatch.
@Test
public void testFilterChoosesFirstMatch() throws Exception {
File source = new File("java/com/foo/FooTest.java");
Collection<TargetInfo> targets = ImmutableList.of(TargetIdeInfo.builder().setLabel("//bar:OtherTest").setKind("java_test").build().toTargetInfo(), TargetIdeInfo.builder().setLabel("//foo:FooTest").setKind("java_test").build().toTargetInfo(), TargetIdeInfo.builder().setLabel("//bar/foo:FooTest").setKind("java_test").build().toTargetInfo());
TargetInfo match = TestTargetHeuristic.chooseTestTargetForSourceFile(project, null, source, targets, null);
assertThat(match.label).isEqualTo(Label.create("//foo:FooTest"));
}
use of com.google.idea.blaze.base.dependencies.TargetInfo in project intellij by bazelbuild.
the class RuleNameHeuristicTest method testPredicateNotMatchingIncorrectPath.
@Test
public void testPredicateNotMatchingIncorrectPath() throws Exception {
File source = new File("java/com/foo/FooTest.java");
TargetInfo target = TargetIdeInfo.builder().setLabel("//foo:bar/FooTest").setKind("java_test").build().toTargetInfo();
assertThat(new TargetNameHeuristic().matchesSource(project, target, null, source, null)).isFalse();
}
use of com.google.idea.blaze.base.dependencies.TargetInfo in project intellij by bazelbuild.
the class TestSizeHeuristicTest method testPredicateDefaultToSmallSize.
@Test
public void testPredicateDefaultToSmallSize() throws Exception {
File source = new File("java/com/foo/FooTest.java");
TargetInfo target = TargetIdeInfo.builder().setLabel("//foo:test").setKind("java_test").setTestInfo(TestIdeInfo.builder().setTestSize(TestSize.SMALL)).build().toTargetInfo();
assertThat(new TestSizeHeuristic().matchesSource(project, target, null, source, null)).isTrue();
target = TargetIdeInfo.builder().setLabel("//foo:test").setKind("java_test").setTestInfo(TestIdeInfo.builder().setTestSize(TestSize.MEDIUM)).build().toTargetInfo();
assertThat(new TestSizeHeuristic().matchesSource(project, target, null, source, null)).isFalse();
}
use of com.google.idea.blaze.base.dependencies.TargetInfo in project intellij by bazelbuild.
the class TestSizeHeuristicTest method testFilterChoosesFirstMatch.
@Test
public void testFilterChoosesFirstMatch() throws Exception {
File source = new File("java/com/foo/FooTest.java");
ImmutableList<TargetInfo> rules = ImmutableList.of(TargetIdeInfo.builder().setLabel("//foo:test1").setKind("java_test").setTestInfo(TestIdeInfo.builder().setTestSize(TestSize.MEDIUM)).build().toTargetInfo(), TargetIdeInfo.builder().setLabel("//foo:test2").setKind("java_test").setTestInfo(TestIdeInfo.builder().setTestSize(TestSize.SMALL)).build().toTargetInfo(), TargetIdeInfo.builder().setLabel("//foo:test3").setKind("java_test").setTestInfo(TestIdeInfo.builder().setTestSize(TestSize.SMALL)).build().toTargetInfo());
TargetInfo match = TestTargetHeuristic.chooseTestTargetForSourceFile(project, null, source, rules, TestSize.SMALL);
assertThat(match.label).isEqualTo(Label.create("//foo:test2"));
}
Aggregations