/** * Returns the ClassLine in which this mutation is located * * @return the ClassLine in which this mutation is located */ public ClassLine getClassLine() { return new ClassLine(this.id.getClassName(), this.lineNumber); }
@Override public Collection<TestInfo> getTestsForClassLine(final ClassLine classLine) { final Collection<TestInfo> result = getTestsForClassName( classLine.getClassName()).get(classLine); if (result == null) { return Collections.emptyList(); } else { return result; } }
private Predicate<MutationDetails> isOnMarkedLine() { return a -> TryWithResourcesFilter.this.lines.contains(a.getClassLine().getLineNumber()); }
private static Set<TestInfo> getLineTestSet(ClassName clazz, Map<ClassLine, Set<TestInfo>> linesToTests, Entry<BlockLocation, Set<TestInfo>> each, int line) { final ClassLine cl = new ClassLine(clazz, line); Set<TestInfo> tis = linesToTests.get(cl); if (tis == null) { tis = new TreeSet<>(new TestInfoNameComparator()); tis.addAll(each.getValue()); linesToTests.put(new ClassLine(clazz, line), tis); } return tis; }
private Predicate<MutationDetails> isOnLoggingLine() { return a -> LoggingCallsFilter.this.lines.contains(a.getClassLine().getLineNumber()); }
private boolean isLineCovered(final int line) { final Predicate<ClassInfo> predicate = a -> !AnnotatedLineFactory.this.statistics.getTestsForClassLine( new ClassLine(a.getName().asInternalName(), line)).isEmpty(); return FCollection.contains(this.classesInFile, predicate); }
@Test public void shouldReturnNoTestsWhenNoTestsCoverALine() { when(this.lm.mapLines(any(ClassName.class))).thenReturn( new HashMap<BlockLocation, Set<Integer>>()); final ClassLine line = new ClassLine("foo", 1); assertEquals(Collections.emptyList(), this.testee.getTestsForClassLine(line)); }
@Test public void shouldStoreExecutionTimesOfTests() { final int line = 1; final int time = 42; final BlockLocationBuilder block = aBlockLocation().withLocation( aLocation().withClass(this.foo)); when(this.lm.mapLines(any(ClassName.class))).thenReturn( makeCoverageMapForBlock(block, line)); final CoverageResultBuilder cr = aCoverageResult().withVisitedBlocks( block.build(1)).withExecutionTime(time); this.testee.calculateClassCoverage(cr.build()); assertEquals(Arrays.asList(42), FCollection.map( this.testee.getTestsForClassLine(new ClassLine(this.foo, line)), testInfoToExecutionTime())); }
/** * Returns the ClassLine in which this mutation is located * * @return the ClassLine in which this mutation is located */ public ClassLine getClassLine() { return new ClassLine(this.id.getClassName(), this.lineNumber); }