<commit_before>package com.deftech.viewtils.test;


import android.app.Activity;
import android.widget.TextView;
import com.deftech.viewtils.matchers.TextViewMatcher;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;

import java.util.concurrent.TimeUnit;

import static com.deftech.viewtils.Helper.with;
import static com.deftech.viewtils.test.TestUtil.createActivity;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

@RunWith(RobolectricTestRunner.class)
@Config(manifest = "src/test/resources/AndroidManifest.xml")
public class MethodRunnerTest {
    @Test
    public void testSetText() {
        Activity activity = createActivity();

        // Get the view
        TextView view = with(activity).find(TextView.class).where(TextViewMatcher.textIs(R.string.tv_str));
        assertNotNull(view);
        assertEquals(view.getText().toString(), view.getContext().getString(R.string.tv_str));

        // Change the text
        with(view).executeOnUiThread("setText")
                .withParameter("Set text", CharSequence.class)
                .usingRobolectric()
                .returningNothing();

        // Validate that the change happened
        view = with(activity).find(TextView.class).where(TextViewMatcher.textIs("Set text"));
        assertNotNull(view);
        assertEquals(view.getText().toString(), "Set text");
    }

    @Test
    public void testDelayedSetText() {
        Activity activity = createActivity();

        // Get the view
        TextView view = with(activity).find(TextView.class).where(TextViewMatcher.textIs(R.string.tv_str));
        assertNotNull(view);
        assertEquals(view.getText().toString(), view.getContext().getString(R.string.tv_str));

        // Change the text
        with(view).executeOnUiThread("setText")
                .withParameter("Set text", CharSequence.class)
                .usingRobolectric()
                .in(100, TimeUnit.MILLISECONDS)
                .returningNothing();

        // Validate that the change happened
        view = with(activity).find(TextView.class).where(TextViewMatcher.textIs("Set text"));
        assertNotNull(view);
        assertEquals(view.getText().toString(), "Set text");
    }

}
<commit_msg>Update delay for delay test<commit_after>package com.deftech.viewtils.test;


import android.app.Activity;
import android.widget.TextView;
import com.deftech.viewtils.matchers.TextViewMatcher;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;

import java.util.concurrent.TimeUnit;

import static com.deftech.viewtils.Helper.with;
import static com.deftech.viewtils.test.TestUtil.createActivity;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

@RunWith(RobolectricTestRunner.class)
@Config(manifest = "src/test/resources/AndroidManifest.xml")
public class MethodRunnerTest {
    @Test
    public void testSetText() {
        Activity activity = createActivity();

        // Get the view
        TextView view = with(activity).find(TextView.class).where(TextViewMatcher.textIs(R.string.tv_str));
        assertNotNull(view);
        assertEquals(view.getText().toString(), view.getContext().getString(R.string.tv_str));

        // Change the text
        with(view).executeOnUiThread("setText")
                .withParameter("Set text", CharSequence.class)
                .usingRobolectric()
                .returningNothing();

        // Validate that the change happened
        view = with(activity).find(TextView.class).where(TextViewMatcher.textIs("Set text"));
        assertNotNull(view);
        assertEquals(view.getText().toString(), "Set text");
    }

    @Test
    public void testDelayedSetText() {
        Activity activity = createActivity();

        // Get the view
        TextView view = with(activity).find(TextView.class).where(TextViewMatcher.textIs(R.string.tv_str));
        assertNotNull(view);
        assertEquals(view.getText().toString(), view.getContext().getString(R.string.tv_str));

        // Change the text
        with(view).executeOnUiThread("setText")
                .withParameter("Set text", CharSequence.class)
                .usingRobolectric()
                .in(1000, TimeUnit.MILLISECONDS) // wait a second
                .returningNothing();

        // Validate that the change happened
        view = with(activity).find(TextView.class).where(TextViewMatcher.textIs("Set text"));
        assertNotNull(view);
        assertEquals(view.getText().toString(), "Set text");
    }

}

{'fraction_non_alphanumeric': 0.12076271186440678, 'fraction_numerical': 0.0014830508474576272, 'mean_word_length': 3.174182139699381, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '136739', 'n_tokens_mistral': 1304, 'n_tokens_neox': 1260, 'n_words': 231}