use of com.google.idea.blaze.base.dependencies.TargetInfo in project intellij by bazelbuild.
the class RuleNameHeuristicTest method testPredicateMatchingNameAndPath.
@Test
public void testPredicateMatchingNameAndPath() throws Exception {
File source = new File("java/com/foo/FooTest.java");
TargetInfo target = TargetIdeInfo.builder().setLabel("//foo:foo/FooTest").setKind("java_test").build().toTargetInfo();
assertThat(new TargetNameHeuristic().matchesSource(project, target, null, source, null)).isTrue();
}
use of com.google.idea.blaze.base.dependencies.TargetInfo in project intellij by bazelbuild.
the class RuleNameHeuristicTest method testFilterNoMatchesFallBackToFirstRule.
@Test
public void testFilterNoMatchesFallBackToFirstRule() throws Exception {
File source = new File("java/com/foo/FooTest.java");
Collection<TargetInfo> targets = ImmutableList.of(TargetIdeInfo.builder().setLabel("//foo:FirstTest").setKind("java_test").build().toTargetInfo(), TargetIdeInfo.builder().setLabel("//bar:OtherTest").setKind("java_test").build().toTargetInfo());
TargetInfo match = TestTargetHeuristic.chooseTestTargetForSourceFile(project, null, source, targets, null);
assertThat(match.label).isEqualTo(Label.create("//foo:FirstTest"));
}
use of com.google.idea.blaze.base.dependencies.TargetInfo in project intellij by bazelbuild.
the class RuleNameHeuristicTest method testPredicateDifferentName.
@Test
public void testPredicateDifferentName() throws Exception {
File source = new File("java/com/foo/FooTest.java");
TargetInfo target = TargetIdeInfo.builder().setLabel("//foo:ForTest").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 testPredicateMatchingSize.
@Test
public void testPredicateMatchingSize() 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.MEDIUM)).build().toTargetInfo();
assertThat(new TestSizeHeuristic().matchesSource(project, target, null, source, TestSize.MEDIUM)).isTrue();
}
use of com.google.idea.blaze.base.dependencies.TargetInfo in project intellij by bazelbuild.
the class TestSizeHeuristicTest method testFilterNoMatchesFallBackToFirstRule.
@Test
public void testFilterNoMatchesFallBackToFirstRule() 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.LARGE)).build().toTargetInfo(), TargetIdeInfo.builder().setLabel("//foo:test3").setKind("java_test").setTestInfo(TestIdeInfo.builder().setTestSize(TestSize.ENORMOUS)).build().toTargetInfo());
TargetInfo match = TestTargetHeuristic.chooseTestTargetForSourceFile(project, null, source, rules, TestSize.SMALL);
assertThat(match.label).isEqualTo(Label.create("//foo:test1"));
}
Aggregations