本文整理汇总了Java中org.pitest.coverage.TestInfo类的典型用法代码示例。如果您正苦于以下问题:Java TestInfo类的具体用法?Java TestInfo怎么用?Java TestInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TestInfo类属于org.pitest.coverage包,在下文中一共展示了TestInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: killingTestHasNotChanged
import org.pitest.coverage.TestInfo; //导入依赖的package包/类
private boolean killingTestHasNotChanged(final MutationDetails each,
final MutationStatusTestPair mutationStatusTestPair) {
final Collection<TestInfo> allTests = this.coverage.getTestsForClass(each
.getClassName());
final List<ClassName> testClasses = FCollection.filter(allTests,
testIsCalled(mutationStatusTestPair.getKillingTest().value())).map(
TestInfo.toDefiningClassName());
if (testClasses.isEmpty()) {
return false;
}
return !this.history.hasClassChanged(testClasses.get(0));
}
示例2: shouldStartPreviousKilledMutationsAtAStatusOfNotStartedWhenNeitherClassOrTestHasChanged
import org.pitest.coverage.TestInfo; //导入依赖的package包/类
@Test
public void shouldStartPreviousKilledMutationsAtAStatusOfNotStartedWhenNeitherClassOrTestHasChanged() {
final MutationDetails md = makeMutation("foo");
final String killingTest = "fooTest";
setHistoryForAllMutationsTo(DetectionStatus.KILLED, killingTest);
final Collection<TestInfo> tests = Collections.singleton(new TestInfo(
"TEST_CLASS", killingTest, 0, Option.<ClassName> none(), 0));
when(this.coverage.getTestsForClass(any(ClassName.class)))
.thenReturn(tests);
when(this.history.hasClassChanged(any(ClassName.class))).thenReturn(false);
final MutationResult actual = this.testee
.analyse(Collections.singletonList(md)).iterator().next();
assertEquals(DetectionStatus.KILLED, actual.getStatus());
assertEquals(Option.some(killingTest), actual.getKillingTest());
}
示例3: shouldStartPreviousKilledMutationsAtAStatusOfKilledWhenNeitherClassOrTestHasChanged
import org.pitest.coverage.TestInfo; //导入依赖的package包/类
@Test
public void shouldStartPreviousKilledMutationsAtAStatusOfKilledWhenNeitherClassOrTestHasChanged() {
final MutationDetails md = makeMutation("foo");
final String killingTest = "fooTest";
setHistoryForAllMutationsTo(DetectionStatus.KILLED, killingTest);
final Collection<TestInfo> tests = Collections.singleton(new TestInfo(
"TEST_CLASS", killingTest, 0, Option.<ClassName> none(), 0));
when(this.coverage.getTestsForClass(any(ClassName.class)))
.thenReturn(tests);
when(this.history.hasClassChanged(ClassName.fromString("foo"))).thenReturn(
false);
when(this.history.hasClassChanged(ClassName.fromString("TEST_CLASS")))
.thenReturn(true);
final MutationResult actual = this.testee
.analyse(Collections.singletonList(md)).iterator().next();
assertEquals(DetectionStatus.NOT_STARTED, actual.getStatus());
}
示例4: testToTestUnit
import org.pitest.coverage.TestInfo; //导入依赖的package包/类
private F<TestInfo, Option<TestUnit>> testToTestUnit() {
return new F<TestInfo, Option<TestUnit>>() {
@Override
public Option<TestUnit> apply(final TestInfo a) {
final TestUnit tu = TimeOutDecoratedTestSource.this.allTests.get(a
.getName());
if (tu != null) {
return Option
.<TestUnit> some(new MutationTimeoutDecorator(tu,
new TimeOutSystemExitSideEffect(
TimeOutDecoratedTestSource.this.r),
TimeOutDecoratedTestSource.this.timeoutStrategy, a.getTime()));
}
return Option.none();
}
};
}
示例5: makeTestInfoNode
import org.pitest.coverage.TestInfo; //导入依赖的package包/类
private String makeTestInfoNode(MutationDetails aDetails) {
List<TestInfo> tests = aDetails.getTestsInOrder();
if (tests == null || tests.isEmpty()) {
return "";
}
StringBuilder result = new StringBuilder();
for (TestInfo info : tests) {
result.append(makeNode(info.getName(), Tag.testInfo));
}
return makeNode(result.toString(), Tag.testInfos);
}
示例6: makeTestPrioritiser
import org.pitest.coverage.TestInfo; //导入依赖的package包/类
public TestPrioritiser makeTestPrioritiser(Properties properties, CodeSource code,
CoverageDatabase coverage) {
Set<TestInfo> tis = new HashSet<TestInfo>();
FCollection.flatMapTo(code.getCodeUnderTestNames(), classToTests(coverage), tis);
List<TestInfo> sorted = new ArrayList<TestInfo>(tis);
// sort to a consistent order
Collections.sort(sorted, nameComparator());
return new AllTestsPrioritiser(sorted);
}
示例7: nameComparator
import org.pitest.coverage.TestInfo; //导入依赖的package包/类
private Comparator<TestInfo> nameComparator() {
return new Comparator<TestInfo>() {
@Override
public int compare(TestInfo arg0, TestInfo arg1) {
return arg0.getName().compareTo(arg1.getName());
}
};
}
示例8: classToTests
import org.pitest.coverage.TestInfo; //导入依赖的package包/类
private static F<ClassName, Iterable<TestInfo>> classToTests(final CoverageDatabase coverage) {
return new F<ClassName, Iterable<TestInfo>>() {
@Override
public Iterable<TestInfo> apply(ClassName clazz) {
return coverage.getTestsForClass(clazz);
}
};
}
示例9: shouldReturnTheWholeSuiteForAnyClass
import org.pitest.coverage.TestInfo; //导入依赖的package包/类
@Test
public void shouldReturnTheWholeSuiteForAnyClass() {
when(code.getCodeUnderTestNames()).thenReturn(Collections.set(foo, bar));
when(coverage.getTestsForClass(foo)).thenReturn(
Arrays.asList(test("a"), test("b")));
when(coverage.getTestsForClass(bar)).thenReturn(Arrays.asList(test("c")));
TestPrioritiser prioritiser = testee.makeTestPrioritiser(props, code, coverage);
List<TestInfo> actual = prioritiser.assignTests(null);
assertThat(actual).containsExactly(test("a"), test("b"), test("c"));
}
示例10: shouldProvideDeterminsticOrderForTests
import org.pitest.coverage.TestInfo; //导入依赖的package包/类
@Test
public void shouldProvideDeterminsticOrderForTests() {
when(code.getCodeUnderTestNames()).thenReturn(Collections.set(foo, bar));
when(coverage.getTestsForClass(foo)).thenReturn(
Arrays.asList(test("z"), test("b"), test("e")));
when(coverage.getTestsForClass(bar)).thenReturn(Arrays.asList(test("a")));
TestPrioritiser prioritiser = testee.makeTestPrioritiser(props, code, coverage);
List<TestInfo> actual = prioritiser.assignTests(null);
assertThat(actual).containsExactly(test("a"), test("b"), test("e"),
test("z"));
}
示例11: testIsCalled
import org.pitest.coverage.TestInfo; //导入依赖的package包/类
private static F<TestInfo, Boolean> testIsCalled(final String testName) {
return new F<TestInfo, Boolean>() {
@Override
public Boolean apply(final TestInfo a) {
return a.getName().equals(testName);
}
};
}
示例12: getAllClassesAndTests
import org.pitest.coverage.TestInfo; //导入依赖的package包/类
private Set<ClassName> getAllClassesAndTests(
final CoverageDatabase coverageData) {
final Set<ClassName> names = new HashSet<>();
for (final ClassName each : this.code.getCodeUnderTestNames()) {
names.add(each);
FCollection.mapTo(coverageData.getTestsForClass(each),
TestInfo.toDefiningClassName(), names);
}
return names;
}
示例13: pickTests
import org.pitest.coverage.TestInfo; //导入依赖的package包/类
private Collection<TestInfo> pickTests(MutationDetails mutation) {
if (!mutation.isInStaticInitializer()) {
return this.coverage.getTestsForClassLine(mutation.getClassLine());
} else {
LOG.warning("Using untargetted tests");
return this.coverage.getTestsForClass(mutation.getClassName());
}
}
示例14: prioritizeTests
import org.pitest.coverage.TestInfo; //导入依赖的package包/类
private List<TestInfo> prioritizeTests(ClassName clazz,
Collection<TestInfo> testsForMutant) {
final List<TestInfo> sortedTis = FCollection.map(testsForMutant,
Prelude.id(TestInfo.class));
Collections.sort(sortedTis, new TestInfoPriorisationComparator(clazz,
TIME_WEIGHTING_FOR_DIRECT_UNIT_TESTS));
return sortedTis;
}
示例15: assignTestsToMutations
import org.pitest.coverage.TestInfo; //导入依赖的package包/类
private void assignTestsToMutations(
final Collection<MutationDetails> availableMutations) {
for (final MutationDetails mutation : availableMutations) {
final List<TestInfo> testDetails = this.testPrioritiser
.assignTests(mutation);
if (testDetails.isEmpty()) {
LOG.fine("According to coverage no tests hit the mutation " + mutation);
}
mutation.addTestsInOrder(testDetails);
}
}