[Demonstration 1]

[Buggy Method]
Map<String, Object> getPost(String id) throws SQLException {
    PreparedStatement statement = connection.prepareStatement(String.format("SELECT p.*, c.name as country, c.geometry as area " + "FROM %s AS p, %s AS c " + "WHERE within(p.user['location'], c.geometry) " + "AND p.id = ?", POST_TABLE, COUNTRIES_TABLE));
    statement.setString(1, id);
    ResultSet results = statement.executeQuery();
    if (results.next()) {
        return resultSetToMap.apply(results);
    } else {
        return ImmutableMap.of();
    }
}

[Buggy Hunk]
return ImmutableMap.of();

[Patch]
return Collections.emptyMap();

[Demonstration 2]

[Buggy Method]
@Test
public void oneRoute() throws IOException {
    TkFork fork = new TkFork(new Fork() {

        @Override
        public Optional<Response> route(Request request) throws IOException {
            return Optional.<Response>of(new RsText("text message"));
        }
    });
    Response response = fork.ack(new ByteRequest("/test", ImmutableMap.<String, String>of(), "test".getBytes()));
    assertThat(new RsPrint(response).print(), startsWith("text message"));
}

[Buggy Hunk]
assertThat(new RsPrint(response).print(), startsWith("text message"));

[Patch]
assertThat(new RsPrint(response).printBody(), startsWith("text message"));

[Demonstration 3]

[Buggy Method]
private Tuple getTuple(String streamId, final Fields fields, Values values) {
    com.twitter.heron.api.topology.TopologyContext context = Mockito.mock(com.twitter.heron.common.utils.topology.TopologyContextImpl.class);
    com.twitter.heron.api.tuple.Fields f = new com.twitter.heron.api.tuple.Fields(fields.toList());
    Mockito.when(context.getComponentOutputFields(Mockito.any(), Mockito.any())).thenReturn(f);
    TopologyAPI.StreamId stream = TopologyAPI.StreamId.newBuilder().setId(streamId).setComponentName("c1").build();
    return new TupleImpl(new com.twitter.heron.common.utils.tuple.TupleImpl(context, stream, 1, null, values));
}

[Buggy Hunk]
Mockito.when(context.getComponentOutputFields(Mockito.any(), Mockito.any())).thenReturn(f);

[Patch]
Mockito.when(context.getComponentOutputFields(Mockito.anyString(), Mockito.anyString())).thenReturn(f);