forked from bazelbuild/rules_scala
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Preserve empty class and sourcefile nodes in XML report (bazelbuild#817)
- Loading branch information
Showing
22 changed files
with
284 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
org.jacoco.report.test/src/org/jacoco/report/internal/html/page/BundlePageTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Evgeny Mandrikov - initial API and implementation | ||
* | ||
*******************************************************************************/ | ||
package org.jacoco.report.internal.html.page; | ||
|
||
import org.jacoco.core.analysis.IBundleCoverage; | ||
import org.jacoco.core.analysis.IClassCoverage; | ||
import org.jacoco.core.analysis.IPackageCoverage; | ||
import org.jacoco.core.analysis.ISourceFileCoverage; | ||
import org.jacoco.core.internal.analysis.BundleCoverageImpl; | ||
import org.jacoco.core.internal.analysis.ClassCoverageImpl; | ||
import org.jacoco.core.internal.analysis.CounterImpl; | ||
import org.jacoco.core.internal.analysis.MethodCoverageImpl; | ||
import org.jacoco.core.internal.analysis.PackageCoverageImpl; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.w3c.dom.Document; | ||
|
||
import java.util.Arrays; | ||
import java.util.Collections; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
/** | ||
* Unit tests for {@link BundlePage}. | ||
*/ | ||
public class BundlePageTest extends PageTestBase { | ||
|
||
@Before | ||
@Override | ||
public void setup() throws Exception { | ||
super.setup(); | ||
} | ||
|
||
@Test | ||
public void should_render_non_empty_packages() throws Exception { | ||
final ClassCoverageImpl classCoverage = new ClassCoverageImpl( | ||
"example/Class", 0, false); | ||
final MethodCoverageImpl methodCoverage = new MethodCoverageImpl("m", | ||
"()V", null); | ||
methodCoverage.increment(CounterImpl.COUNTER_1_0, | ||
CounterImpl.COUNTER_0_0, 42); | ||
classCoverage.addMethod(methodCoverage); | ||
final IPackageCoverage nonEmptyPackage = new PackageCoverageImpl( | ||
"example", | ||
Collections.<IClassCoverage> singleton(classCoverage), | ||
Collections.<ISourceFileCoverage> emptySet()); | ||
|
||
final IPackageCoverage emptyPackage = new PackageCoverageImpl("empty", | ||
Collections.<IClassCoverage> emptySet(), | ||
Collections.<ISourceFileCoverage> emptySet()); | ||
|
||
final IBundleCoverage node = new BundleCoverageImpl("bundle", | ||
Arrays.asList(nonEmptyPackage, emptyPackage)); | ||
|
||
final BundlePage page = new BundlePage(node, null, null, rootFolder, | ||
context); | ||
page.render(); | ||
|
||
final Document doc = support.parse(output.getFile("index.html")); | ||
assertEquals("el_package", support.findStr(doc, | ||
"/html/body/table[1]/tbody/tr[1]/td[1]/a/@class")); | ||
assertEquals("example", support.findStr(doc, | ||
"/html/body/table[1]/tbody/tr[1]/td[1]/a")); | ||
assertEquals("1", | ||
support.findStr(doc, "count(/html/body/table[1]/tbody/tr)")); | ||
} | ||
|
||
} |
Oops, something went wrong.