当前位置: 首页>>代码示例>>Java>>正文


Java TestInfo类代码示例

本文整理汇总了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));

}
 
开发者ID:hcoles,项目名称:pitest,代码行数:17,代码来源:IncrementalAnalyser.java

示例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());
}
 
开发者ID:hcoles,项目名称:pitest,代码行数:18,代码来源:IncrementalAnalyserTest.java

示例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());
}
 
开发者ID:hcoles,项目名称:pitest,代码行数:20,代码来源:IncrementalAnalyserTest.java

示例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();
    }

  };
}
 
开发者ID:hcoles,项目名称:pitest,代码行数:20,代码来源:TimeOutDecoratedTestSource.java

示例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);
}
 
开发者ID:mirkosertic,项目名称:mavensonarsputnik,代码行数:13,代码来源:PITestResultListener.java

示例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);
}
 
开发者ID:hcoles,项目名称:pitest-plugins,代码行数:13,代码来源:AllTestsPrioritiserFactory.java

示例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());
    }
    
  };
}
 
开发者ID:hcoles,项目名称:pitest-plugins,代码行数:10,代码来源:AllTestsPrioritiserFactory.java

示例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);
    }
    
  };
}
 
开发者ID:hcoles,项目名称:pitest-plugins,代码行数:10,代码来源:AllTestsPrioritiserFactory.java

示例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"));

}
 
开发者ID:hcoles,项目名称:pitest-plugins,代码行数:15,代码来源:AllTestsPrioritiserFactoryTest.java

示例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"));

}
 
开发者ID:hcoles,项目名称:pitest-plugins,代码行数:16,代码来源:AllTestsPrioritiserFactoryTest.java

示例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);
    }

  };
}
 
开发者ID:hcoles,项目名称:pitest,代码行数:10,代码来源:IncrementalAnalyser.java

示例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;
}
 
开发者ID:hcoles,项目名称:pitest,代码行数:11,代码来源:MutationCoverage.java

示例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());
  }
}
 
开发者ID:hcoles,项目名称:pitest,代码行数:9,代码来源:DefaultTestPrioritiser.java

示例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;
}
 
开发者ID:hcoles,项目名称:pitest,代码行数:9,代码来源:DefaultTestPrioritiser.java

示例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);
  }
}
 
开发者ID:hcoles,项目名称:pitest,代码行数:12,代码来源:MutationSource.java


注:本文中的org.pitest.coverage.TestInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。