<commit_before>/*
 * Copyright (c) 2022 toastkidjp.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompany this distribution.
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html.
 */

package jp.toastkid.yobidashi.browser.page_search

import android.view.View
import androidx.databinding.ViewStubProxy
import io.mockk.MockKAnnotations
import io.mockk.every
import io.mockk.impl.annotations.InjectMockKs
import io.mockk.impl.annotations.MockK
import io.mockk.unmockkAll
import org.junit.After
import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Test

class PageSearcherModuleTest {

    @InjectMockKs
    private lateinit var pageSearcherModule: PageSearcherModule

    @MockK
    private lateinit var viewStubProxy: ViewStubProxy

    @Before
    fun setUp() {
        MockKAnnotations.init(this)
        every { viewStubProxy.isInflated }.returns(true)
        every { viewStubProxy.root?.visibility }.returns(View.VISIBLE)
    }

    @After
    fun tearDown() {
        unmockkAll()
    }

    @Test
    fun testIsVisible() {
        assertTrue(pageSearcherModule.isVisible())
    }

}<commit_msg>refactor #283 Add test case.<commit_after>/*
 * Copyright (c) 2022 toastkidjp.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompany this distribution.
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html.
 */

package jp.toastkid.yobidashi.browser.page_search

import android.view.View
import androidx.databinding.ViewStubProxy
import io.mockk.MockKAnnotations
import io.mockk.every
import io.mockk.impl.annotations.InjectMockKs
import io.mockk.impl.annotations.MockK
import io.mockk.unmockkAll
import org.junit.After
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Test

class PageSearcherModuleTest {

    @InjectMockKs
    private lateinit var pageSearcherModule: PageSearcherModule

    @MockK
    private lateinit var viewStubProxy: ViewStubProxy

    @Before
    fun setUp() {
        MockKAnnotations.init(this)
        every { viewStubProxy.isInflated }.returns(true)
        every { viewStubProxy.root?.visibility }.returns(View.VISIBLE)
    }

    @After
    fun tearDown() {
        unmockkAll()
    }

    @Test
    fun testIsVisible() {
        assertTrue(pageSearcherModule.isVisible())
    }

    @Test
    fun test() {
        every { viewStubProxy.isInflated }.returns(false)

        assertFalse(pageSearcherModule.isVisible())
    }
}
{'fraction_non_alphanumeric': 0.08483290488431877, 'fraction_numerical': 0.00697759823723834, 'mean_word_length': 3.593591905564924, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '2019753', 'n_tokens_mistral': 850, 'n_tokens_neox': 831, 'n_words': 201}