<commit_before>package jp.toastkid.yobidashi.browser

import android.webkit.WebView
import io.mockk.MockKAnnotations
import io.mockk.every
import io.mockk.impl.annotations.MockK
import io.mockk.mockk
import io.mockk.verify
import org.junit.Before
import org.junit.Test

/**
 * @author toastkidjp
 */
class HtmlSourceExtractionUseCaseTest {

    @MockK
    private lateinit var webView: WebView

    @Before
    fun setUp() {
        MockKAnnotations.init(this)
    }

    @Test
    fun test() {
        every { webView.url }.returns("https://www.yahoo.co.jp")
        every { webView.evaluateJavascript(any(), any()) }.answers { Unit }

        HtmlSourceExtractionUseCase().invoke(webView, mockk())

        verify (exactly = 1) { webView.evaluateJavascript(any(), any()) }
    }

    @Test
    fun test1() {
        every { webView.url }.returns("https://accounts.google.com/signin")
        every { webView.evaluateJavascript(any(), any()) }.answers { Unit }

        HtmlSourceExtractionUseCase().invoke(webView, mockk())

        verify (exactly = 0) { webView.evaluateJavascript(any(), any()) }
    }
}<commit_msg>refactor #451 Rename test case.<commit_after>package jp.toastkid.yobidashi.browser

import android.webkit.WebView
import io.mockk.MockKAnnotations
import io.mockk.every
import io.mockk.impl.annotations.MockK
import io.mockk.mockk
import io.mockk.verify
import org.junit.Before
import org.junit.Test

/**
 * @author toastkidjp
 */
class HtmlSourceExtractionUseCaseTest {

    @MockK
    private lateinit var webView: WebView

    @Before
    fun setUp() {
        MockKAnnotations.init(this)
    }

    @Test
    fun test() {
        every { webView.url }.returns("https://www.yahoo.co.jp")
        every { webView.evaluateJavascript(any(), any()) }.answers { Unit }

        HtmlSourceExtractionUseCase().invoke(webView, mockk())

        verify (exactly = 1) { webView.evaluateJavascript(any(), any()) }
    }

    @Test
    fun testExceptingCase() {
        every { webView.url }.returns("https://accounts.google.com/signin")
        every { webView.evaluateJavascript(any(), any()) }.answers { Unit }

        HtmlSourceExtractionUseCase().invoke(webView, mockk())

        verify (exactly = 0) { webView.evaluateJavascript(any(), any()) }
    }
}
{'fraction_non_alphanumeric': 0.13215859030837004, 'fraction_numerical': 0.003524229074889868, 'mean_word_length': 3.221189591078067, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, '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': '1569235', 'n_tokens_mistral': 785, 'n_tokens_neox': 718, 'n_words': 140}