[Demonstration 1]

[Buggy Method]
static public void main(String[] args) throws IOException {
    OkEdgeState state = new OkEdgeState().cookies(true).insecure(true).loggingLevel(OkEdge.LoggingLevel.HEADERS);
    Response response;
    /**
     *        response = new OkEdge(state)
     *            //.insecure(true)
     *            //.logging(OkEdge.LoggingLevel.BODY)
     *            .postJson("http://jsonplaceholder.typicode.com/posts").body(
     *                "{\n" +
     *                "\"userId\": 1,\n" +
     *                "\"id\": 1,\n" +
     *                "\"title\": \"this is a title\",\n" +
     *                "\"body\": \"a body\"\n" +
     *                "}")
     *            .execute();
     */
    /**
     *        response = new OkEdge(state)
     *            .getJson("http://jsonplaceholder.typicode.com/posts/1")
     *            .execute();
     */
    response = new OkEdge(state).get("http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.11-win32.zip").execute();
    System.out.println("Done executing, has response...");
    // 1-shot body...
    InputStream input = response.body().byteStream();
    File targetFile = new File("mysql-5.7.11-win32.zip");
    OutputStream output = new FileOutputStream(targetFile);
    byte[] buffer = new byte[8 * 1024];
    int bytesRead;
    System.err.println("About to start I/O from input to output");
    while ((bytesRead = input.read(buffer)) != -1) {
        output.write(buffer, 0, bytesRead);
        System.err.println(".");
    }
    /**
     *        response = new OkEdge()
     *        .insecure(true)
     *        .logging(OkEdge.LoggingLevel.BODY)
     *        .cookies(true)
     *        .get("https://example.com/")
     *        .execute();
     *        System.out.println("response: " + response.code());
     *        response = new OkEdge()
     *        .insecure(true)
     *        .logging(OkEdge.LoggingLevel.BODY)
     *        .cookies(true)
     *        .get("https://example.com")
     *        .execute();
     *        System.out.println("response: " + response.code());
     *        response = new OkEdge()
     *        .insecure(true)
     *        .logging(OkEdge.LoggingLevel.BODY)
     *        .cookies(true)
     *        .postForm("https://example.com")
     *        .add("username", "jjlauer")
     *        .add("password", "test")
     *        .commit()
     *        .execute();
     *        System.out.println("response: " + response.code());
     */
}

[Buggy Hunk]
.loggingLevel(OkEdge.LoggingLevel.HEADERS);

[Patch]
.logging(OkEdge.LoggingLevel.HEADERS);

[Demonstration 2]

[Buggy Method]
private void verifyLifecycleEvent(final Message<?> msg, final LifecycleState lifecycleState) {
    assertNotNull(msg);
    assertNotNull(msg.getPayload());
    assertTrue(msg.getPayload() instanceof LifecycleEvent);
    assertEquals(((LifecycleEvent) msg.getPayload()).getState(), lifecycleState);
}

[Buggy Hunk]
assertEquals(((LifecycleEvent) msg.getPayload()).getState(), lifecycleState);

[Patch]
assertEquals(lifecycleState, ((LifecycleEvent) msg.getPayload()).getState());

[Demonstration 3]

[Buggy Method]
private void vote(@NotNull SBuild build, @NotNull BuildRevision revision, @NotNull BitbucketCloudBuildStatus status, @NotNull String comment) {
    String msg = createMessage(status, build.getBuildPromotion().getBuildTypeId(), getBuildName(build), myLinks.getViewResultsUrl(build), comment);
    try {
        final VcsRootInstance root = revision.getRoot();
        Repository repository = BitbucketCloudRepositoryParser.parseRepository(root);
        if (repository == null)
            throw new PublishError("Cannot parse repository from VCS root url " + root.getName());
        vote(revision.getRevision(), msg, repository);
    } catch (Exception e) {
        throw new PublishError("Cannot publish status to Bitbucket Cloud for VCS root " + revision.getRoot().getName() + ": " + getMessage(e), e);
    }
}

[Buggy Hunk]
String msg = createMessage(status, build.getBuildPromotion().getBuildTypeId(), getBuildName(build), myLinks.getViewResultsUrl(build), comment);

[Patch]
String msg = createMessage(status, build.getBuildPromotion().getBuildTypeId(), getBuildName(build), "http://rankida.com", comment);