Skip to content

Commit

Permalink
test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mrFlick72 committed Oct 6, 2023
1 parent 1c69a51 commit 0e986ea
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ package com.vauthenticator.server.account.signup

import com.vauthenticator.server.account.AccountTestFixture.anAccount
import com.vauthenticator.server.account.Email
import com.vauthenticator.server.account.mailverification.SendVerifyMailChallenge
import com.vauthenticator.server.account.repository.AccountRepository
import com.vauthenticator.server.account.welcome.SayWelcome
import com.vauthenticator.server.clientapp.ClientAppFixture.aClientApp
import com.vauthenticator.server.events.SignUpEvent
import com.vauthenticator.server.events.VAuthenticatorEventsDispatcher
Expand Down Expand Up @@ -39,15 +37,9 @@ internal class SignUpUseTest {
@MockK
lateinit var passwordPolicy: PasswordPolicy

@MockK
lateinit var sayWelcome: SayWelcome

@MockK
lateinit var vAuthenticatorPasswordEncoder: VAuthenticatorPasswordEncoder

@MockK
lateinit var sendVerifyMailChallenge: SendVerifyMailChallenge

@MockK
lateinit var vAuthenticatorEventsDispatcher: VAuthenticatorEventsDispatcher

Expand Down Expand Up @@ -77,8 +69,6 @@ internal class SignUpUseTest {
every { clientAccountRepository.findOne(clientAppId) } returns Optional.of(aClientApp)
every { vAuthenticatorPasswordEncoder.encode("secret") } returns "encrypted_secret"
every { accountRepository.create(account) } just runs
every { sayWelcome.welcome(account.email) } just runs
every { sendVerifyMailChallenge.sendVerifyMail("[email protected]") } just runs
every { vAuthenticatorEventsDispatcher.dispatch(signUpEvent) } just runs


Expand All @@ -88,8 +78,6 @@ internal class SignUpUseTest {
verify { clientAccountRepository.findOne(clientAppId) }
verify { vAuthenticatorPasswordEncoder.encode("secret") }
verify { accountRepository.create(account) }
verify { sayWelcome.welcome(account.email) }
verify { sendVerifyMailChallenge.sendVerifyMail("[email protected]") }
verify { vAuthenticatorEventsDispatcher.dispatch(signUpEvent) }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import io.mockk.junit5.MockKExtension
import io.mockk.just
import io.mockk.runs
import io.mockk.verify
import org.junit.jupiter.api.Assertions.*
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.ExtendWith

Expand All @@ -25,11 +24,15 @@ class SpringEventsCollectorTest {
val underTest = SpringEventsCollector(listOf(eventConsumer, anotherEventConsumer))

every { eventConsumer.accept(vauthenticatorAuthEvent) } just runs
every { eventConsumer.handleable(vauthenticatorAuthEvent) } returns true
every { anotherEventConsumer.accept(vauthenticatorAuthEvent) } just runs
every { anotherEventConsumer.handleable(vauthenticatorAuthEvent) } returns true

underTest.accept(vauthenticatorAuthEvent)

verify { eventConsumer.accept(vauthenticatorAuthEvent) }
verify { anotherEventConsumer.accept(vauthenticatorAuthEvent) }
verify { anotherEventConsumer.accept(vauthenticatorAuthEvent) }
verify { anotherEventConsumer.handleable(vauthenticatorAuthEvent) }
}
}

0 comments on commit 0e986ea

Please sign in to comment.