use of com.google.idea.blaze.base.dependencies.TargetInfo in project intellij by bazelbuild.
the class TestSizeHeuristicTest method testPredicateDifferentSize.
@Test
public void testPredicateDifferentSize() 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.SMALL)).isFalse();
}
use of com.google.idea.blaze.base.dependencies.TargetInfo in project intellij by bazelbuild.
the class TestTargetSourcesHeuristicTest method testFilterNoMatchesFallBackToFirstRule.
@Test
public void testFilterNoMatchesFallBackToFirstRule() throws Exception {
File source = workspaceRoot.fileForPath(new WorkspacePath("java/com/foo/FooTest.java"));
ImmutableList<TargetInfo> rules = 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").build().toTargetInfo());
TargetInfo match = TestTargetHeuristic.chooseTestTargetForSourceFile(project, null, source, rules, null);
assertThat(match.label).isEqualTo(Label.create("//foo:test1"));
}
use of com.google.idea.blaze.base.dependencies.TargetInfo in project intellij by bazelbuild.
the class TestTargetSourcesHeuristicTest method testPredicateNoMatchingSource.
@Test
public void testPredicateNoMatchingSource() {
File source = workspaceRoot.fileForPath(new WorkspacePath("java/com/foo/FooTest.java"));
TargetInfo target = TargetIdeInfo.builder().setLabel("//foo:test").setKind("java_test").addSource(sourceRoot("java/com/bar/OtherTest.java")).build().toTargetInfo();
assertThat(new TestTargetSourcesHeuristic().matchesSource(project, target, null, source, null)).isFalse();
}
use of com.google.idea.blaze.base.dependencies.TargetInfo in project intellij by bazelbuild.
the class TestTargetSourcesHeuristicTest method testFilterOneMatch.
@Test
public void testFilterOneMatch() throws Exception {
File source = workspaceRoot.fileForPath(new WorkspacePath("java/com/foo/FooTest.java"));
ImmutableList<TargetInfo> rules = 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(project, null, source, rules, 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 TestTargetSourcesHeuristicTest method testPredicateNoSources.
@Test
public void testPredicateNoSources() {
File source = workspaceRoot.fileForPath(new WorkspacePath("java/com/foo/FooTest.java"));
TargetInfo target = TargetIdeInfo.builder().setLabel("//foo:test").setKind("java_test").build().toTargetInfo();
assertThat(new TestTargetSourcesHeuristic().matchesSource(project, target, null, source, null)).isFalse();
}
Aggregations