[Demonstration 1]

[Buggy Method]
@Before
public void setUp() {
    tokenRepository = mock(TokenRepositoryWrapper.class);
    userRepository = mock(UserRepositoryWrapper.class);
    tokenUtil = mock(TokenUtil.class);
    securityService = mock(SecurityService.class);
    intercept = new AuthIntercept(tokenRepository, userRepository, tokenUtil, securityService);
    response = mock(HttpServletResponse.class);
    method = mock(HandlerMethod.class);
    Authenticate authenticate = mock(Authenticate.class);
    when(authenticate.role()).thenReturn("generic");
    when(method.getMethodAnnotation(Authenticate.class)).thenReturn(authenticate);
    token = new Token();
    token.setUsername("test");
    token.setTimestamp(System.currentTimeMillis());
    token.setValue("test");
    user = new User();
    Set<Role> roles = new HashSet<>();
    Role role = new Role();
    role.setName("generic");
    roles.add(role);
    user.setRoles(roles);
    request = mock(HttpServletRequest.class);
    when(request.getHeader(AuthIntercept.TOKEN_HEADER)).thenReturn("test");
    when(request.getHeader(AuthIntercept.USERNAME_HEADER)).thenReturn("test");
    when(tokenRepository.findOne(anyString())).thenReturn(CompletableFuture.completedFuture(token));
    when(tokenUtil.hasExpired(any(Token.class))).thenReturn(false);
    when(tokenUtil.canRenew(any(Token.class))).thenReturn(false);
    when(userRepository.findByUsername(anyString())).thenReturn(CompletableFuture.completedFuture(user));
}

[Buggy Hunk]
Authenticate authenticate = mock(Authenticate.class);

[Patch]
authenticate = mock(Authenticate.class);

[Demonstration 2]

[Buggy Method]
@Override
public boolean contains(T expected) {
    ListNode<T> current = firstNode;
    while (current != null) {
        if (current.getObject().equals(expected))
            return true;
        current = current.getNext();
    }
    return false;
}

[Buggy Hunk]
if(current.getObject().equals(expected))

[Patch]
if(current.getData().equals(expected))

[Demonstration 3]

[Buggy Method]
@RequestMapping(value = "/rest/quote/indexes")
public List<StockQuote> indexQuotes() {
    log.debug("request indexQuotes");
    return httpService.getStringAsync(Money18IndexQuoteParser.URL, Money18IndexQuoteParser::parse).join();
}

[Buggy Hunk]
return httpService.getStringAsync(Money18IndexQuoteParser.URL, Money18IndexQuoteParser::parse).join();

[Patch]
return httpService.queryAsync(Money18IndexQuoteParser.createRequest()::asStringAsync, Money18IndexQuoteParser::parse).join();