use of org.jacoco.report.ILanguageNames in project jacoco by jacoco.
the class ClassRowWriterTest method setup.
@Before
public void setup() throws Exception {
ILanguageNames names = new ILanguageNames() {
public String getClassName(String vmname, String vmsignature, String vmsuperclass, String[] vminterfaces) {
return vmname;
}
public String getPackageName(String vmname) {
return vmname;
}
public String getQualifiedClassName(String vmname) {
throw new AssertionError();
}
public String getMethodName(String vmclassname, String vmmethodname, String vmdesc, String vmsignature) {
throw new AssertionError();
}
public String getQualifiedMethodName(String vmclassname, String vmmethodname, String vmdesc, String vmsignature) {
throw new AssertionError();
}
};
result = new StringWriter();
writer = new ClassRowWriter(new DelimitedWriter(result), names);
}
use of org.jacoco.report.ILanguageNames in project jacoco by jacoco.
the class HTMLFormatterTest method testGetLanguageNames.
@Test
public void testGetLanguageNames() throws Exception {
ILanguageNames names = new ILanguageNames() {
public String getPackageName(String vmname) {
return null;
}
public String getQualifiedClassName(String vmname) {
return null;
}
public String getClassName(String vmname, String vmsignature, String vmsuperclass, String[] vminterfaces) {
return null;
}
public String getMethodName(String vmclassname, String vmmethodname, String vmdesc, String vmsignature) {
return null;
}
public String getQualifiedMethodName(String vmclassname, String vmmethodname, String vmdesc, String vmsignature) {
return null;
}
};
formatter.setLanguageNames(names);
assertSame(names, formatter.getLanguageNames());
output.close();
}
use of org.jacoco.report.ILanguageNames in project jacoco by jacoco.
the class RulesCheckerTest method testSetLanguageNames.
@Test
public void testSetLanguageNames() throws IOException {
Rule rule = new Rule();
rule.setElement(ElementType.CLASS);
Limit limit = rule.createLimit();
limit.setValue(CounterValue.MISSEDCOUNT.name());
limit.setMaximum("5");
checker.setRules(Arrays.asList(rule));
checker.setLanguageNames(new ILanguageNames() {
public String getQualifiedClassName(String vmname) {
return "MyClass";
}
public String getQualifiedMethodName(String vmclassname, String vmmethodname, String vmdesc, String vmsignature) {
return null;
}
public String getPackageName(String vmname) {
return null;
}
public String getMethodName(String vmclassname, String vmmethodname, String vmdesc, String vmsignature) {
return null;
}
public String getClassName(String vmname, String vmsignature, String vmsuperclass, String[] vminterfaces) {
return null;
}
});
driver.sendGroup(checker.createVisitor(this));
assertEquals(Arrays.asList("Rule violated for class MyClass: instructions missed count is 10, but expected maximum is 5"), messages);
}
use of org.jacoco.report.ILanguageNames in project jacoco by jacoco.
the class PageTestBase method setup.
protected void setup() throws Exception {
output = new MemoryMultiReportOutput();
rootFolder = new ReportOutputFolder(output);
final Resources resources = new Resources(rootFolder);
final Table table = new Table();
table.add("Element", null, new LabelColumn(), true);
context = new IHTMLReportContext() {
public ILanguageNames getLanguageNames() {
return new JavaNames();
}
public Resources getResources() {
return resources;
}
public Table getTable() {
return table;
}
public String getFooterText() {
return "CustomFooter";
}
public ILinkable getSessionsPage() {
return new LinkableStub("sessions.html", "Sessions", Styles.EL_SESSION);
}
public String getOutputEncoding() {
return "UTF-8";
}
public IIndexUpdate getIndexUpdate() {
return new IIndexUpdate() {
public void addClass(ILinkable link, long classid) {
}
};
}
public Locale getLocale() {
return Locale.ENGLISH;
}
};
support = new HTMLSupport();
}
use of org.jacoco.report.ILanguageNames in project jacoco by jacoco.
the class SessionsPage method executionDataTable.
private void executionDataTable(final HTMLElement body) throws IOException {
final HTMLElement table = body.table(Styles.COVERAGETABLE);
{
final HTMLElement tr = table.thead().tr();
tr.td().text("Class");
tr.td().text("Id");
}
final HTMLElement tbody = table.tbody();
final ILanguageNames names = context.getLanguageNames();
for (final ExecutionData e : executionData) {
final HTMLElement tr = tbody.tr();
final String link = index.getLinkToClass(e.getId());
final String qualifiedName = names.getQualifiedClassName(e.getName());
if (link == null) {
tr.td().span(Styles.EL_CLASS).text(qualifiedName);
} else {
tr.td().a(link, Styles.EL_CLASS).text(qualifiedName);
}
final String id = String.format("%016x", Long.valueOf(e.getId()));
tr.td().code().text(id);
}
}
Aggregations