<commit_before>package com.redux

import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertNotEquals
import kotlin.test.assertTrue
import org.junit.Test as test

class StoreTest {

    test fun actionShouldBeReduced() {
        val reducer = Reducer { action: MyAction, state: MyState ->
            when (action.type) {
                "to reduce" -> MyState("reduced")
                else -> state
            }
        }

        val store = Store.create(MyState(), reducer)
        store.dispatch(MyAction(type = "to reduce"))

        assertEquals("reduced", store.getState().state)
    }

    test fun storeShouldNotifySubscribers() {
        val store = Store.create(MyState(), Reducer { action: MyAction, state: MyState ->  MyState()})
        val subscriber1 = TestSubscriber()
        val subscriber2 = TestSubscriber()

        store.subscribe(subscriber1)
        store.subscribe(subscriber2)
        store.dispatch(MyAction())

        assertTrue(subscriber1.called)
        assertTrue(subscriber2.called)
    }


    test fun storeShouldNotNotifyWhenUnsubscribed() {
        val store = Store.create(MyState(), Reducer { action: MyAction, state: MyState ->  MyState()})
        val subscriber1 = TestSubscriber()
        val subscriber2 = TestSubscriber()

        store.subscribe(subscriber1)
        val subscription = store.subscribe(subscriber2)
        subscription.unsubscribe()
        store.dispatch(MyAction())

        assertTrue(subscriber1.called)
        assertFalse(subscriber2.called)
    }


    data class MyAction(val type: String = "unknown") : Action
<commit_msg>Add `@` before test annotations in Kotlin<commit_after>package com.redux

import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertTrue
import org.junit.Test as test

class StoreTest {

    @test fun actionShouldBeReduced() {
        val reducer = Reducer { action: MyAction, state: MyState ->
            when (action.type) {
                "to reduce" -> MyState("reduced")
                else -> state
            }
        }

        val store = Store.create(MyState(), reducer)
        store.dispatch(MyAction(type = "to reduce"))

        assertEquals("reduced", store.getState().state)
    }

    @test fun storeShouldNotifySubscribers() {
        val store = Store.create(MyState(), Reducer { action: MyAction, state: MyState ->  MyState()})
        val subscriber1 = TestSubscriber()
        val subscriber2 = TestSubscriber()

        store.subscribe(subscriber1)
        store.subscribe(subscriber2)
        store.dispatch(MyAction())

        assertTrue(subscriber1.called)
        assertTrue(subscriber2.called)
    }


    @test fun storeShouldNotNotifyWhenUnsubscribed() {
        val store = Store.create(MyState(), Reducer { action: MyAction, state: MyState ->  MyState()})
        val subscriber1 = TestSubscriber()
        val subscriber2 = TestSubscriber()

        store.subscribe(subscriber1)
        val subscription = store.subscribe(subscriber2)
        subscription.unsubscribe()
        store.dispatch(MyAction())

        assertTrue(subscriber1.called)
        assertFalse(subscriber2.called)
    }


    data class MyAction(val type: String = "unknown") : Action

{'fraction_non_alphanumeric': 0.10141364474492932, 'fraction_numerical': 0.007375537799631223, 'mean_word_length': 2.7030716723549486, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '5520092', 'n_tokens_mistral': 919, 'n_tokens_neox': 881, 'n_words': 199}