private Function<Integer, TestInfo> timeToTestInfo() { return a -> new TestInfo("foo", "bar", a, Optional.<ClassName> empty(), 0); }
public static Function<TestInfo, String> toName() { return a -> a.getName(); }
private Function<TestInfo, Stream<TestUnit>> testToTestUnit() { return a -> { final TestUnit tu = TimeOutDecoratedTestSource.this.allTests.get(a .getName()); if (tu != null) { return Stream .<TestUnit> of(new MutationTimeoutDecorator(tu, new TimeOutSystemExitSideEffect( TimeOutDecoratedTestSource.this.r), TimeOutDecoratedTestSource.this.timeoutStrategy, a.getTime())); } return Stream.empty(); }; }
public TestInfo(final String definingClass, final String name, final int time, final Optional<ClassName> testee, final int blocksCovered) { this.definingClass = internIfNotNull(definingClass); this.name = name; this.time = time; this.testee = testee.orElse(null); this.blocks = blocksCovered; }
private int weightForDirectHit(final TestInfo arg0) { return arg0.directlyHits(this.targetClass) ? this.distanceTimeWeighting : 0; }
private int weightFor(final TestInfo ti) { return weightForDirectHit(ti) - (ti.getNumberOfBlocksCovered() / 10); }
private static Function<TestInfo, Integer> testInfoToExecutionTime() { return a -> a.getTime(); }
public TestInfo(final String definingClass, final String name, final int time, final Optional<ClassName> testee, final int blocksCovered) { this.definingClass = internIfNotNull(definingClass); this.name = name; this.time = time; this.testee = testee.orElse(null); this.blocks = blocksCovered; }
private Function<Integer, TestInfo> timeToTestInfo() { return a -> new TestInfo("foo", "bar", a, Optional.<ClassName> empty(), 0); }
private Function<TestInfo, Stream<TestUnit>> testToTestUnit() { return a -> { final TestUnit tu = TimeOutDecoratedTestSource.this.allTests.get(a .getName()); if (tu != null) { return Stream .<TestUnit> of(new MutationTimeoutDecorator(tu, new TimeOutSystemExitSideEffect( TimeOutDecoratedTestSource.this.r), TimeOutDecoratedTestSource.this.timeoutStrategy, a.getTime())); } return Stream.empty(); }; }
private Function<TestInfo, Integer> toTime() { return a -> a.getTime(); }
private static Predicate<TestInfo> testIsCalled(final String testName) { return a -> a.getName().equals(testName); }
@Test public void shouldFavourTestsThatDirectlyTestTargetOverFasterTestsThatDontByApplyingATimeWeighting() { final TestInfo slowButClose = testInfo(TIME_WEIGHTING, TARGET); final TestInfo fastButDistant = testInfo(1, "notTarget"); final TestInfo verySlowButClose = testInfo( TIME_WEIGHTING + fastButDistant.getTime() + 1, TARGET); final List<TestInfo> actual = sortWithTestee(verySlowButClose, slowButClose, fastButDistant); assertThat(actual, is(Arrays.asList(slowButClose, fastButDistant, verySlowButClose))); }
private TestInfo testInfo(final int time, final String target, final int linesCovered) { return new TestInfo("", time + target + linesCovered, time, Optional.ofNullable(ClassName.fromString(target)), linesCovered); }
private static Function<TestInfo, String> testInfoToString() { return a -> a.getName(); }
private Function<String, TestInfo> toTestInfo(final BlockCoverage blockData) { return a -> new TestInfo(null, a, 0, Optional.ofNullable(blockData.getBlock().getLocation().getClassName()), blockData.getBlock().getBlock()); }
public static Function<TestInfo, String> toName() { return a -> a.getName(); }