<commit_before>package net.squanchy.notification

import io.reactivex.Single
import net.squanchy.schedule.domain.view.Event
import net.squanchy.schedule.domain.view.anEvent
import net.squanchy.support.system.TestCurrentTime
import org.junit.Before
import org.junit.Test
import org.mockito.Mock
import org.mockito.Mockito
import org.mockito.MockitoAnnotations
import org.threeten.bp.Duration
import org.threeten.bp.ZoneId
import org.threeten.bp.ZoneOffset
import org.threeten.bp.ZonedDateTime

class UpcomingEventsServiceTest {

    @Mock
    lateinit var service: NotificationService

    private val currentTime = TestCurrentTime(NOW)

    lateinit var upcomingEventsService: UpcomingEventsService

    @Before
    fun setUp() {
        MockitoAnnotations.initMocks(this)
        upcomingEventsService = UpcomingEventsService(
            service,
            currentTime,
            INTERVAL
        )
    }

    @Test
    fun upcomingEventsEmitsOnlyEventsStartingAfterNowInsideInterval() {
        givenServiceWillReturn(
            BEFORE_NOW,<commit_msg>Use test rule instead of manually initializing annotations<commit_after>package net.squanchy.notification

import io.reactivex.Single
import net.squanchy.schedule.domain.view.Event
import net.squanchy.schedule.domain.view.anEvent
import net.squanchy.support.system.TestCurrentTime
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.mockito.Mock
import org.mockito.Mockito
import org.mockito.junit.MockitoJUnit
import org.mockito.junit.MockitoRule
import org.threeten.bp.Duration
import org.threeten.bp.ZoneId
import org.threeten.bp.ZoneOffset
import org.threeten.bp.ZonedDateTime

class UpcomingEventsServiceTest {

    @get:Rule
    val mockitoRule: MockitoRule = MockitoJUnit.rule()
    
    @Mock
    lateinit var service: NotificationService

    private val currentTime = TestCurrentTime(NOW)

    lateinit var upcomingEventsService: UpcomingEventsService

    @Before
    fun setUp() {
        upcomingEventsService = UpcomingEventsService(
            service,
            currentTime,
            INTERVAL
        )
    }

    @Test
    fun upcomingEventsEmitsOnlyEventsStartingAfterNowInsideInterval() {
        givenServiceWillReturn(
            BEFORE_NOW,
{'fraction_non_alphanumeric': 0.06557377049180328, 'fraction_numerical': 0.0, 'mean_word_length': 3.684647302904564, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6817928', 'n_tokens_mistral': 670, 'n_tokens_neox': 638, 'n_words': 128}