[Demonstration 1]

[Buggy Method]
public MetadataMessageBuilder getBuilderForType(final MetadataMessageBuilder builder, String branch) {
    final boolean isDeprecated = javaType.hasAnnotation(Deprecated.class);
    builder.appendContent("`" + getTypeType() + "` ");
    builder.appendContent((isDeprecated ? "~~" : "") + "`" + javaType.getQualifiedName() + "`" + (isDeprecated ? "~~" : "") + "\n");
    EmbedBuilder embed = new EmbedBuilder().ignoreNullEmptyFields().withFooterText("Branch: " + branch);
    embed.withAuthorName(javaType.getName());
    embed.withAuthorIcon(getTypeIcon());
    if (javaType instanceof Extendable) {
        Extendable<?> jt = (Extendable) javaType;
        if (jt.getSuperType() != null) {
            embed.appendField("Extends", "`" + jt.getSuperType() + "`", false);
        }
    }
    if (javaType instanceof InterfaceCapable) {
        InterfaceCapable jt = (InterfaceCapable) javaType;
        if (jt.getInterfaces().size() > 0) {
            embed.appendField("Implements", jt.getInterfaces().stream().collect(Collectors.joining("\n", "`", "`")), false);
        }
    }
    addJavaDocFields(embed, javaType.getJavaDoc());
    {
        MethodHolder<?> methodHolder = (MethodHolder<?>) javaType;
        String desc = "Found " + methodHolder.getMethods().size() + " method" + (methodHolder.getMethods().size() == 1 ? "" : "s") + "\n";
        if (methodHolder.getMethods().size() > 16) {
        }
        int index = 0;
        for (Method m : methodHolder.getMethods()) {
            desc += "`";
            desc += m.getName();
            desc += getMethodParams(m, false);
            desc += " : ";
            desc += (m.getReturnType() == null ? (m.isConstructor() ? "constructor" : "void") : m.getReturnType().toString());
            desc += "`";
            desc += "\n";
            index++;
            if (index % 10 == 0 || index == methodHolder.getMethods().size() - 1) {
                embed.appendField("Methods" + (index > 10 ? " (cont.)" : ""), desc, false);
                desc = "";
            }
        }
    }
    builder.withEmbed(embed.build());
    return builder;
}

[Buggy Hunk]
desc += (m.getReturnType() == null

[Patch]
desc += (m.getReturnType() == null || m.getReturnType().getQualifiedNameWithGenerics().endsWith("void")

[Demonstration 2]

[Buggy Method]
@Test
public void simpleRun_similar_1() throws IOException, ParserConfigurationException, TransformerException {
    // prepare two mathml files, cmml is in the annotate element
    String refMathML = IOUtils.toString(this.getClass().getResourceAsStream("mathml_query_pure_1.xml"), "UTF-8");
    String compMathML = IOUtils.toString(this.getClass().getResourceAsStream("mathml_annotation_3.xml"), "UTF-8");
    // test the old comparison results
    Map<String, Object> result = MathPlag.compareOriginalFactors(refMathML, compMathML);
    assertThat(result, notNullValue());
    assertThat(result.get("coverage"), is(0.0));
    assertThat(result.get("depth"), nullValue());
    assertThat(result.get("structure match"), is(true));
    assertThat(result.get("formula"), is(true));
    // test the identical mathplag results
    List<Match> identMatch = MathPlag.compareIdenticalMathML(refMathML, compMathML);
    assertThat(identMatch, notNullValue());
    assertThat(identMatch.size(), is(0));
    // test the similar mathplag results
    List<Match> simMatch = MathPlag.compareSimilarMathML(refMathML, compMathML);
    assertThat(simMatch, notNullValue());
    assertThat(simMatch.size(), is(1));
    // the query has no id attribute for the qvar element
    assertThat(simMatch.get(0).getId(), nullValue());
    // The query should be completely found inside the comparisonMathML, depth is therefor = 1
    assertThat(simMatch.get(0).getDepth(), is(1));
    assertThat(simMatch.get(0).getMatches().get(0).getDepth(), is(1));
}

[Buggy Hunk]
public void simpleRun_similar_1() throws IOException, ParserConfigurationException, TransformerException {

[Patch]
public void simpleRun_similar_1() throws IOException, ParserConfigurationException, TransformerException, XPathExpressionException {

[Demonstration 3]

[Buggy Method]
protected ProbeTestClass getClassAnnotation(Description description) {
    return description.getMethod().getClass().getAnnotation(ProbeTestClass.class);
}

[Buggy Hunk]
return description.getMethod().getClass().getAnnotation(ProbeTestClass.class);

[Patch]
return description.getMethod().getDeclaringClass().getAnnotation(ProbeTestClass.class);