/** * Constructs a link to the given Java element. * * @param packageName packageName the name of the package. * @param typeName typeName the name of the Java type. * @param method the test method to link to. * @return the requested relative link. */ public String constructLink(final String packageName, final String typeName, final MethodInfo method) { final JavaElementRef ref = new JavaElementRef(packageName, typeName, method); return constructLink(ref); }
/** * Default constructor. * * @param reportId the report ID this strategy is constructed for. * @param basePath the base path to the report to prefix the constructed link. * @param strategy the strategy to construct the link suffix to the base path. * @throws IllegalArgumentException if <code>helper</code> or * <code>reportLocation</code> is <code>null</code> or * <code>reportArtifactId</code> is blank. */ public ExternalReport(final ReportId reportId, final String basePath, final LinkConstructorStrategy strategy) throws IllegalArgumentException { checkArguments(reportId, basePath, strategy); this.reportId = reportId; this.basePath = basePath; this.strategy = strategy; }
protected void renderReports(final Type type, final List<ExternalReport> reports, final TestMethodDoc testMethod) throws XMLStreamException { if (!reports.isEmpty()) { xmlWriter.writeStartElement(TESTDOC_NS, "reports"); for (final ExternalReport report : reports) { xmlWriter.writeStartElement(TESTDOC_NS, "report"); final String messageKey = report.getLabelKey(); final String label = messages.getLabel(messageKey); writeElement("name", label); final String link = report.constructLink(type.getPackageName(), type.getTypeName(), testMethod); writeElement("link", link); xmlWriter.writeEndElement(); } xmlWriter.writeEndElement(); } }
/** * {@inheritDoc} */ public ExternalReport createExternalReport(final ReportId reportId, final LinkConstructorStrategy strategy) { if (reportId == null) { throw new IllegalArgumentException("The report ID is required."); } if (strategy == null) { throw new IllegalArgumentException( "The link construction strategy is required."); } final String reportBasePath = createRelativeReportLocationLink(reportId, strategy); if (reportBasePath != null) { return new ExternalReport(reportId, reportBasePath, strategy); } else { return null; } }
protected void renderReports(final Type type, final List<ExternalReport> reports, final TestMethodDoc testMethod) throws XMLStreamException { if (!reports.isEmpty()) { xmlWriter.writeStartElement(TESTDOC_NS, "reports"); for (final ExternalReport report : reports) { xmlWriter.writeStartElement(TESTDOC_NS, "report"); final String messageKey = report.getLabelKey(); final String label = messages.getLabel(messageKey); writeElement("name", label); final String link = report.constructLink(type.getPackageName(), type.getTypeName(), testMethod); writeElement("link", link); xmlWriter.writeEndElement(); } xmlWriter.writeEndElement(); } }
void renderTestMethodLink(final ExternalReport report) { final String messageKey = report.getLabelKey(); final Type type = getType(); final String link = report.constructLink(type.getPackageName(), type.getTypeName(), getTestMethod()); if (link != null) { sink.link(link); final String label = messages.getLabel(messageKey); sink.text(label); sink.link_(); } }
void renderTestMethodLink(final ExternalReport report) { final String messageKey = report.getLabelKey(); final Type type = getType(); final String link = report.constructLink(type.getPackageName(), type.getTypeName(), getTestMethod()); if (link != null) { sink.link(link); final String label = messages.getLabel(messageKey); sink.text(label); sink.link_(); } }