[Demonstration 1]

[Buggy Method]
@Test
public void whenOnValueChangedTrueThenSetMultivalueTrue() {
    prepareSystem(withZeCollection().withConstellioRMModule().withAllTestUsers());
    EnableOrDisableContainerMultiValueMetadataScript enableOrDisableContainerMultiValueMetadataScript = new EnableOrDisableContainerMultiValueMetadataScript();
    enableOrDisableContainerMultiValueMetadataScript.onValueChanged(false, true, getModelLayerFactory());
    assertThat(metadataSchemasManager.getSchemaTypes(zeCollection).getMetadata(ContainerRecord.STORAGE_SPACE).isMultivalue()).isTrue();
}

[Buggy Hunk]
assertThat(metadataSchemasManager.getSchemaTypes(zeCollection).getMetadata(ContainerRecord.STORAGE_SPACE).isMultivalue()).isTrue();

[Patch]
assertThat(metadataSchemasManager.getSchemaTypes(zeCollection).getMetadata(ContainerRecord.DEFAULT_SCHEMA + "_" + ContainerRecord.STORAGE_SPACE).isMultivalue()).isTrue();

[Demonstration 2]

[Buggy Method]
@Test
public void doFilterWhenAuthorizationCodeErrorResponseThenAuthenticationFailureHandlerIsCalled() throws Exception {
    ClientRegistration clientRegistration = TestUtil.githubClientRegistration();
    AuthorizationCodeAuthenticationFilter filter = Mockito.spy(setupFilter(clientRegistration));
    AuthenticationFailureHandler failureHandler = mock(AuthenticationFailureHandler.class);
    filter.setAuthenticationFailureHandler(failureHandler);
    MockHttpServletRequest request = this.setupRequest(clientRegistration);
    String errorCode = OAuth2Error.INVALID_GRANT_ERROR_CODE;
    request.addParameter(OAuth2Parameter.ERROR, errorCode);
    request.addParameter(OAuth2Parameter.STATE, "some state");
    MockHttpServletResponse response = new MockHttpServletResponse();
    FilterChain filterChain = mock(FilterChain.class);
    filter.doFilter(request, response, filterChain);
    Mockito.verify(filter).attemptAuthentication(Matchers.any(HttpServletRequest.class), Matchers.any(HttpServletResponse.class));
    Mockito.verify(failureHandler).onAuthenticationFailure(Matchers.any(HttpServletRequest.class), Matchers.any(HttpServletResponse.class), Matchers.any(AuthenticationException.class));
}

[Buggy Hunk]
String errorCode = OAuth2Error.INVALID_GRANT_ERROR_CODE;

[Patch]
String errorCode = OAuth2ErrorCode.INVALID_GRANT;

[Demonstration 3]

[Buggy Method]
public static ArrayList<Token> tokenize(StringBuilder input) throws InvalidTokenException {
    ArrayList<Token> tokens = new ArrayList<>();
    // cleaning input from comment2 and string_literals first
    for (int i = 0; i < input.length(); i++) {
        // starting a string literal
        if (input.charAt(i) == '"') {
            for (int j = i + 1; j < input.length(); j++) {
                if (input.charAt(j) == '"') {
                    Token token = new Token(i, regExps.get(1).getType(), input.substring(i, j + 1));
                    tokens.add(token);
                    for (int k = i; k <= j; k++) {
                        input.setCharAt(k, terminator);
                    }
                    i = j;
                    break;
                }
            }
        }
        // starting a comment2 literal
        if (i > 0 && input.charAt(i - 1) == '/' && input.charAt(i) == '*') {
            for (int j = i + 2; j < input.length(); j += 2) {
                if (input.charAt(j) == '/' && input.charAt(j - 1) == '*') {
                    Token token = new Token(i, regExps.get(0).getType(), input.substring(i, j + 1));
                    tokens.add(token);
                }
                for (int k = i; k <= j; k++) {
                    input.setCharAt(k, terminator);
                }
                i = j;
                break;
            }
        }
    }
    // start matching top priority expressions first
    // notice that IDs are matched outside this loop
    for (int i = 0; i < regExps.size() - 1; i++) {
        RegExp expression = regExps.get(i);
        Pattern pattern = Pattern.compile(expression.getRegExp());
        Matcher matcher = pattern.matcher(input);
        while (matcher.find()) {
            int start = matcher.start();
            int end = matcher.end();
            Token token = new Token(start, expression.getType(), matcher.group(0));
            tokens.add(token);
            // substituting the found token in code with a terminator character
            while (start < end) {
                input.setCharAt(start, terminator);
                start += 1;
            }
        }
    }
    // matching the ids of variables
    RegExp expression = regExps.get(regExps.size() - 1);
    Pattern pattern = Pattern.compile(expression.getRegExp());
    Matcher matcher = pattern.matcher(input);
    while (matcher.find()) {
        int start = matcher.start();
        int end = matcher.end();
        Token token = new Token(start, expression.getType(), matcher.group(0));
        tokens.add(token);
        // substituting the found token in code with a terminator character
        while (start < end) {
            input.setCharAt(start, terminator);
            start += 1;
        }
    }
    // detecting non-matched tokens
    for (int i = 0; i < input.length(); i++) {
        if (input.charAt(i) != '#') {
            throw new InvalidTokenException();
        }
    }
    return tokens;
}

[Buggy Hunk]
if(input.charAt(i) != '#') {

[Patch]
if(input.charAt(i) != '#' && input.charAt(i) != ' ') {