Migrate Kotlin Mockito tests to Mockk

Closes gh-22345
This commit is contained in:
Sebastien Deleuze
2019-02-05 15:42:12 +01:00
parent 00855c4f5f
commit 0b9522c84e
13 changed files with 140 additions and 221 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,13 +16,12 @@
package org.springframework.messaging.simp.annotation.support
import io.mockk.mockk
import java.util.Collections
import java.util.HashMap
import org.junit.Before
import org.junit.Test
import org.mockito.Mock
import org.mockito.MockitoAnnotations
import org.springframework.context.support.StaticApplicationContext
import org.springframework.messaging.Message
@@ -49,19 +48,16 @@ import org.springframework.messaging.handler.annotation.MessageExceptionHandler
class SimpAnnotationMethodMessageHandlerKotlinTests {
lateinit var messageHandler: TestSimpAnnotationMethodMessageHandler
lateinit var messageHandler: TestSimpAnnotationMethodMessageHandler
lateinit var testController: TestController
lateinit var testController: TestController
@Mock
lateinit var channel: SubscribableChannel
val channel = mockk<SubscribableChannel>(relaxed = true)
@Mock
lateinit var converter: MessageConverter
val converter = mockk<MessageConverter>(relaxed = true)
@Before
fun setup() {
MockitoAnnotations.initMocks(this)
val brokerTemplate = SimpMessagingTemplate(channel)
brokerTemplate.messageConverter = converter
messageHandler = TestSimpAnnotationMethodMessageHandler(brokerTemplate, channel, channel)