<commit_before>package me.kirimin.mitsumine.test;

import java.util.List;

import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import me.kirimin.mitsumine.model.Feed;
import me.kirimin.mitsumine.network.BookmarkFeedAccessor;
import me.kirimin.mitsumine.network.BookmarkFeedAccessor.CATEGORY;
import me.kirimin.mitsumine.network.BookmarkFeedAccessor.FeedListener;
import me.kirimin.mitsumine.network.BookmarkFeedAccessor.TYPE;
import me.kirimin.mitsumine.network.RequestQueueSingleton;

import static org.junit.Assert.assertTrue;

@RunWith(AndroidJUnit4.class)
public class BookmarkFeedAccessorTest {

    public BookmarkFeedAccessorTest() {
    }

    @Test
    public void requestCategoryはFeedを取得できる() {
        BookmarkFeedAccessor.requestCategory(RequestQueueSingleton.getRequestQueue(InstrumentationRegistry.getContext()), new FeedListener() {

            @Override
            public void onSuccess(List<Feed> feedList) {
                if (!feedList.isEmpty()) {
                    assertTrue(true);
                }
            }

            @Override
            public void onError(String errorMessage) {
                assertTrue(false);
            }
        }, CATEGORY.MAIN, TYPE.HOT);
    }

    @Test
    public void requestKeywordはFeedを取得できる() {
        BookmarkFeedAccessor.requestKeyword(RequestQueueSingleton.getRequestQueue(InstrumentationRegistry.getContext()), new FeedListener() {

            @Override
            public void onSuccess(List<Feed> feedList) {
                if (!feedList.isEmpty()) {
                    assertTrue(true);
                }
            }

            @Override
            public void onError(String errorMessage) {
                assertTrue(false);
            }
        }, "Java");
    }

    @Test
    public void requestUserBookmarkはFeedを取得できる() {
        BookmarkFeedAccessor.requestUserBookmark(RequestQueueSingleton.getRequestQueue(InstrumentationRegistry.getContext()), new FeedListener() {

            @Override
            public void onSuccess(List<Feed> feedList) {
                if (!feedList.isEmpty()) {
                    assertTrue(true);
                }
            }

            @Override
            public void onError(String errorMessage) {
                assertTrue(false);
            }
        }, "hajimepg");
    }
}<commit_msg>非同期処理のテストを修正<commit_after>package me.kirimin.mitsumine.test;

import java.util.List;

import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

import junit.framework.Assert;

import org.junit.Test;
import org.junit.runner.RunWith;

import me.kirimin.mitsumine.model.Feed;
import me.kirimin.mitsumine.network.BookmarkFeedAccessor;
import me.kirimin.mitsumine.network.BookmarkFeedAccessor.CATEGORY;
import me.kirimin.mitsumine.network.BookmarkFeedAccessor.FeedListener;
import me.kirimin.mitsumine.network.BookmarkFeedAccessor.TYPE;
import me.kirimin.mitsumine.network.RequestQueueSingleton;

@RunWith(AndroidJUnit4.class)
public class BookmarkFeedAccessorTest {

    public BookmarkFeedAccessorTest() {
    }

    @Test
    public void requestCategoryはFeedを取得できる() throws InterruptedException {
        final boolean[] flag = {false};
        BookmarkFeedAccessor.requestCategory(RequestQueueSingleton.getRequestQueue(InstrumentationRegistry.getContext()), new FeedListener() {

            @Override
            public void onSuccess(List<Feed> feedList) {
                flag[0] = true;
            }

            @Override
            public void onError(String errorMessage) {
                Assert.fail();
            }
        }, CATEGORY.MAIN, TYPE.HOT);

        if (!waitForSuccess(flag)) {
            Assert.fail();
        }
    }

    @Test
    public void requestKeywordはFeedを取得できる() throws InterruptedException {
        final boolean[] flag = {false};
        BookmarkFeedAccessor.requestKeyword(RequestQueueSingleton.getRequestQueue(InstrumentationRegistry.getContext()), new FeedListener() {

            @Override
            public void onSuccess(List<Feed> feedList) {
                if (!feedList.isEmpty()) {
                    flag[0] = true;
                } else {
                    Assert.fail();
                }
            }

            @Override
            public void onError(String errorMessage) {
                Assert.fail();
            }
        }, "Java");

        if (!waitForSuccess(flag)) {
            Assert.fail();
        }
    }

    @Test
    public void requestUserBookmarkはFeedを取得できる() throws InterruptedException {
        final boolean[] flag = {false};
        BookmarkFeedAccessor.requestUserBookmark(RequestQueueSingleton.getRequestQueue(InstrumentationRegistry.getContext()), new FeedListener() {

            @Override
            public void onSuccess(List<Feed> feedList) {
                if (!feedList.isEmpty()) {
                    flag[0] = true;
                } else {
                    Assert.fail();
                }
            }

            @Override
            public void onError(String errorMessage) {
                Assert.fail();
            }
        }, "hajimepg");

        if (!waitForSuccess(flag)) {
            Assert.fail();
        }
    }

    private boolean waitForSuccess(boolean[] flag) throws InterruptedException {
        for (int i = 0; i < 100; i++) {
            if (flag[0]) return true;
            Thread.sleep(50);
        }
        return false;
    }
}
{'fraction_non_alphanumeric': 0.09504950495049505, 'fraction_numerical': 0.0025202520252025204, 'mean_word_length': 2.2134181607865817, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 9, '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': '6037832', 'n_tokens_mistral': 1556, 'n_tokens_neox': 1505, 'n_words': 251}