<commit_before>package com.xtremelabs.droidsugar;

import java.lang.reflect.Method;

import org.junit.internal.runners.JUnit4ClassRunner;
import org.junit.runner.notification.RunNotifier;

public class AbstractAndroidTestRunner extends JUnit4ClassRunner {
    private ClassHandler classHandler;

    public AbstractAndroidTestRunner(Class<?> testClass, Loader loader) throws org.junit.internal.runners.InitializationError {
        super(loader.bootstrap(testClass));
    }

    public AbstractAndroidTestRunner(Class<?> testClass, Loader loader, ClassHandler classHandler) throws org.junit.internal.runners.InitializationError {
        this(testClass, loader);
        this.classHandler = classHandler;

        loader.delegateLoadingOf(getClass().getName());
    }

    @Override
    protected void invokeTestMethod(Method method, RunNotifier notifier) {
        if (classHandler != null) classHandler.beforeTest();

        super.invokeTestMethod(method, notifier);

        if (classHandler != null) classHandler.afterTest();
    }
}<commit_msg>Add before/after test hook to AbstractAndroidTestRunner.<commit_after>package com.xtremelabs.droidsugar;

import java.lang.reflect.Method;

import org.junit.internal.runners.JUnit4ClassRunner;
import org.junit.runner.notification.RunNotifier;

public class AbstractAndroidTestRunner extends JUnit4ClassRunner {
    private ClassHandler classHandler;

    public AbstractAndroidTestRunner(Class<?> testClass, Loader loader) throws org.junit.internal.runners.InitializationError {
        super(loader.bootstrap(testClass));
    }

    public AbstractAndroidTestRunner(Class<?> testClass, Loader loader, ClassHandler classHandler) throws org.junit.internal.runners.InitializationError {
        this(testClass, loader);
        this.classHandler = classHandler;

        loader.delegateLoadingOf(getClass().getName());
    }

    @Override
    protected void invokeTestMethod(Method method, RunNotifier notifier) {
        if (classHandler != null) classHandler.beforeTest();

        beforeTest(method);
        super.invokeTestMethod(method, notifier);
        afterTest(method);

        if (classHandler != null) classHandler.afterTest();
    }

    protected void beforeTest(Method method) {
    }

    protected void afterTest(Method method) {
    }
}
{'fraction_non_alphanumeric': 0.0911062906724512, 'fraction_numerical': 0.0017353579175704988, 'mean_word_length': 4.2889908256880735, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '7390022', 'n_tokens_mistral': 609, 'n_tokens_neox': 599, 'n_words': 125}