<commit_before>/*
 * Created on 12-Aug-2004
 * 
 * (c) 2003-2004 ThoughtWorks Ltd
 *
 * See license.txt for license details
 */
package com.thoughtworks.jbehave.core.responsibility;

import java.lang.reflect.Method;

import com.thoughtworks.jbehave.core.Listener;
import com.thoughtworks.jbehave.core.exception.JBehaveFrameworkError;

/**
 * @author <a href="mailto:<EMAIL>"><NAME></a>
 */
public class NotifyingResponsibilityVerifier implements ResponsibilityVerifier {

    /**
     * Verify an individual responsibility.
     * 
     * The {@link Listener} is alerted before and after the verification,
     * with calls to {@link Listener#responsibilityVerificationStarting(Method)
     * responsibilityVerificationStarting(this)} and
     * {@link Listener#responsibilityVerificationEnding(Result, Object)
     * responsibilityVerificationEnding(result)} respectively.
     */
    public Result verifyResponsibility(Listener listener, Method method, Object instance) {
        try {
            listener.responsibilityVerificationStarting(method);
            Result result = doVerifyResponsibility(method, instance);
            listener.responsibilityVerificationEnding(result, instance);
            return result;
        } catch (Exception e) {
            System.out.println("Problem verifying " + method);
            throw new JBehaveFrameworkError(e);
        }
    }

    protected Result doVerifyResponsibility(Method method, Object instance) {
        return new Result(method.getDeclaringClass().getName(), method.getName());
    }

}<commit_msg>Fix JIRA ISSUE JBEHAVE-14<commit_after>/*
 * Created on 12-Aug-2004
 * 
 * (c) 2003-2004 ThoughtWorks Ltd
 *
 * See license.txt for license details
 */
package com.thoughtworks.jbehave.core.responsibility;

import java.lang.reflect.Method;

import com.thoughtworks.jbehave.core.Listener;
import com.thoughtworks.jbehave.core.exception.JBehaveFrameworkError;

/**
 * @author <a href="mailto:<EMAIL>"><NAME></a>
 */
public class NotifyingResponsibilityVerifier implements ResponsibilityVerifier {

    /**
     * Verify an individual responsibility.
     * 
     * The {@link Listener} is alerted before and after the verification,
     * with calls to {@link Listener#responsibilityVerificationStarting(Method)
     * responsibilityVerificationStarting(this)} and
     * {@link Listener#responsibilityVerificationEnding(Result, Object)
     * responsibilityVerificationEnding(result)} respectively.
     */
    public Result verifyResponsibility(Listener listener, Method method, Object instance) {
        try {
            listener.responsibilityVerificationStarting(method);
            Result result = doVerifyResponsibility(method, instance);
            result = listener.responsibilityVerificationEnding(result, instance);
            return result;
        } catch (Exception e) {
            System.out.println("Problem verifying " + method);
            throw new JBehaveFrameworkError(e);
        }
    }

    protected Result doVerifyResponsibility(Method method, Object instance) {
        return new Result(method.getDeclaringClass().getName(), method.getName());
    }

}
{'fraction_non_alphanumeric': 0.09653858367735789, 'fraction_numerical': 0.00952683391552874, 'mean_word_length': 3.612005856515373, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7065185', 'n_tokens_mistral': 866, 'n_tokens_neox': 813, 'n_words': 188}