use of com.google.idea.blaze.base.dependencies.TargetInfo in project intellij by bazelbuild.
the class TestTargetHeuristicTest method testTargetSourcesCheckedBeforeTestSize.
@Test
public void testTargetSourcesCheckedBeforeTestSize() {
File source = workspaceRoot.fileForPath(new WorkspacePath("java/com/foo/FooTest.java"));
Collection<TargetInfo> targets = ImmutableList.of(TargetIdeInfo.builder().setLabel("//foo:test1").setKind("java_test").setTestInfo(TestIdeInfo.builder().setTestSize(TestSize.SMALL)).addSource(sourceRoot("java/com/bar/OtherTest.java")).build().toTargetInfo(), TargetIdeInfo.builder().setLabel("//foo:test2").setKind("java_test").setTestInfo(TestIdeInfo.builder().setTestSize(TestSize.MEDIUM)).addSource(sourceRoot("java/com/foo/FooTest.java")).build().toTargetInfo());
TargetInfo match = TestTargetHeuristic.chooseTestTargetForSourceFile(getProject(), null, source, targets, TestSize.SMALL);
assertThat(match.label).isEqualTo(Label.create("//foo:test2"));
}
use of com.google.idea.blaze.base.dependencies.TargetInfo in project intellij by bazelbuild.
the class TestTargetHeuristicTest method testTargetSourcesMatched.
@Test
public void testTargetSourcesMatched() {
File source = workspaceRoot.fileForPath(new WorkspacePath("java/com/foo/FooTest.java"));
Collection<TargetInfo> targets = ImmutableList.of(TargetIdeInfo.builder().setLabel("//foo:test1").setKind("java_test").addSource(sourceRoot("java/com/bar/OtherTest.java")).build().toTargetInfo(), TargetIdeInfo.builder().setLabel("//foo:test2").setKind("java_test").addSource(sourceRoot("java/com/foo/FooTest.java")).build().toTargetInfo());
TargetInfo match = TestTargetHeuristic.chooseTestTargetForSourceFile(getProject(), null, source, targets, null);
assertThat(match.label).isEqualTo(Label.create("//foo:test2"));
}
use of com.google.idea.blaze.base.dependencies.TargetInfo in project intellij by bazelbuild.
the class TestTargetHeuristicTest method testTargetNameCheckedBeforeTestSize.
@Test
public void testTargetNameCheckedBeforeTestSize() {
File source = workspaceRoot.fileForPath(new WorkspacePath("java/com/foo/FooTest.java"));
ImmutableList<TargetInfo> targets = ImmutableList.of(TargetIdeInfo.builder().setLabel("//bar:BarTest").setKind("java_test").setTestInfo(TestIdeInfo.builder().setTestSize(TestSize.SMALL)).build().toTargetInfo(), TargetIdeInfo.builder().setLabel("//foo:FooTest").setKind("java_test").setTestInfo(TestIdeInfo.builder().setTestSize(TestSize.MEDIUM)).build().toTargetInfo());
TargetInfo match = TestTargetHeuristic.chooseTestTargetForSourceFile(getProject(), null, source, targets, TestSize.SMALL);
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 testFilterOneMatch.
@Test
public void testFilterOneMatch() throws Exception {
File source = new File("java/com/foo/FooTest.java");
Collection<TargetInfo> targets = ImmutableList.of(TargetIdeInfo.builder().setLabel("//bar:FirstTest").setKind("java_test").build().toTargetInfo(), TargetIdeInfo.builder().setLabel("//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 testPredicateMatchingName.
@Test
public void testPredicateMatchingName() throws Exception {
File source = new File("java/com/foo/FooTest.java");
TargetInfo target = TargetIdeInfo.builder().setLabel("//foo:FooTest").setKind("java_test").build().toTargetInfo();
assertThat(new TargetNameHeuristic().matchesSource(project, target, null, source, null)).isTrue();
}
Aggregations