Polishing
This commit is contained in:
parent
736bf1c502
commit
86580b2358
|
@ -4,8 +4,7 @@ import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
import org.mockito.Answers
|
import org.mockito.Answers
|
||||||
import org.mockito.Mock
|
import org.mockito.Mock
|
||||||
import org.mockito.Mockito
|
import org.mockito.Mockito.*
|
||||||
import org.mockito.Mockito.verify
|
|
||||||
import org.mockito.junit.MockitoJUnitRunner
|
import org.mockito.junit.MockitoJUnitRunner
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -22,20 +21,20 @@ class BeanFactoryExtensionsTests {
|
||||||
@Test
|
@Test
|
||||||
fun `getBean with KClass`() {
|
fun `getBean with KClass`() {
|
||||||
bf.getBean(Foo::class)
|
bf.getBean(Foo::class)
|
||||||
verify(bf, Mockito.times(1)).getBean(Foo::class.java)
|
verify(bf, times(1)).getBean(Foo::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `getBean with reified type parameters`() {
|
fun `getBean with reified type parameters`() {
|
||||||
bf.getBean<Foo>()
|
bf.getBean<Foo>()
|
||||||
verify(bf, Mockito.times(1)).getBean(Foo::class.java)
|
verify(bf, times(1)).getBean(Foo::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `getBean with String and reified type parameters`() {
|
fun `getBean with String and reified type parameters`() {
|
||||||
val name = "foo"
|
val name = "foo"
|
||||||
bf.getBean<Foo>(name)
|
bf.getBean<Foo>(name)
|
||||||
verify(bf, Mockito.times(1)).getBean(name, Foo::class.java)
|
verify(bf, times(1)).getBean(name, Foo::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -43,7 +42,7 @@ class BeanFactoryExtensionsTests {
|
||||||
val arg1 = "arg1"
|
val arg1 = "arg1"
|
||||||
val arg2 = "arg2"
|
val arg2 = "arg2"
|
||||||
bf.getBean(Foo::class, arg1, arg2)
|
bf.getBean(Foo::class, arg1, arg2)
|
||||||
verify(bf, Mockito.times(1)).getBean(Foo::class.java, arg1, arg2)
|
verify(bf, times(1)).getBean(Foo::class.java, arg1, arg2)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -51,7 +50,7 @@ class BeanFactoryExtensionsTests {
|
||||||
val arg1 = "arg1"
|
val arg1 = "arg1"
|
||||||
val arg2 = "arg2"
|
val arg2 = "arg2"
|
||||||
bf.getBean<Foo>(arg1, arg2)
|
bf.getBean<Foo>(arg1, arg2)
|
||||||
verify(bf, Mockito.times(1)).getBean(Foo::class.java, arg1, arg2)
|
verify(bf, times(1)).getBean(Foo::class.java, arg1, arg2)
|
||||||
}
|
}
|
||||||
|
|
||||||
class Foo
|
class Foo
|
||||||
|
|
|
@ -4,7 +4,7 @@ import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
import org.mockito.Answers
|
import org.mockito.Answers
|
||||||
import org.mockito.Mock
|
import org.mockito.Mock
|
||||||
import org.mockito.Mockito
|
import org.mockito.Mockito.*
|
||||||
import org.mockito.junit.MockitoJUnitRunner
|
import org.mockito.junit.MockitoJUnitRunner
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -13,7 +13,7 @@ import org.mockito.junit.MockitoJUnitRunner
|
||||||
* @author Sebastien Deleuze
|
* @author Sebastien Deleuze
|
||||||
*/
|
*/
|
||||||
@RunWith(MockitoJUnitRunner::class)
|
@RunWith(MockitoJUnitRunner::class)
|
||||||
class ListenableBeanFactoryExtensionsTests {
|
class ListableBeanFactoryExtensionsTests {
|
||||||
|
|
||||||
@Mock(answer = Answers.RETURNS_MOCKS)
|
@Mock(answer = Answers.RETURNS_MOCKS)
|
||||||
lateinit var lbf: ListableBeanFactory
|
lateinit var lbf: ListableBeanFactory
|
||||||
|
@ -21,111 +21,111 @@ class ListenableBeanFactoryExtensionsTests {
|
||||||
@Test
|
@Test
|
||||||
fun `getBeanNamesForType with KClass`() {
|
fun `getBeanNamesForType with KClass`() {
|
||||||
lbf.getBeanNamesForType(Foo::class)
|
lbf.getBeanNamesForType(Foo::class)
|
||||||
Mockito.verify(lbf, Mockito.times(1)).getBeanNamesForType(Foo::class.java, true , true)
|
verify(lbf, times(1)).getBeanNamesForType(Foo::class.java, true , true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `getBeanNamesForType with KClass and Boolean`() {
|
fun `getBeanNamesForType with KClass and Boolean`() {
|
||||||
lbf.getBeanNamesForType(Foo::class, false)
|
lbf.getBeanNamesForType(Foo::class, false)
|
||||||
Mockito.verify(lbf, Mockito.times(1)).getBeanNamesForType(Foo::class.java, false , true)
|
verify(lbf, times(1)).getBeanNamesForType(Foo::class.java, false , true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `getBeanNamesForType with KClass, Boolean and Boolean`() {
|
fun `getBeanNamesForType with KClass, Boolean and Boolean`() {
|
||||||
lbf.getBeanNamesForType(Foo::class, false, false)
|
lbf.getBeanNamesForType(Foo::class, false, false)
|
||||||
Mockito.verify(lbf, Mockito.times(1)).getBeanNamesForType(Foo::class.java, false , false)
|
verify(lbf, times(1)).getBeanNamesForType(Foo::class.java, false , false)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `getBeanNamesForType with reified type parameters`() {
|
fun `getBeanNamesForType with reified type parameters`() {
|
||||||
lbf.getBeanNamesForType<Foo>()
|
lbf.getBeanNamesForType<Foo>()
|
||||||
Mockito.verify(lbf, Mockito.times(1)).getBeanNamesForType(Foo::class.java, true , true)
|
verify(lbf, times(1)).getBeanNamesForType(Foo::class.java, true , true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `getBeanNamesForType with reified type parameters and Boolean`() {
|
fun `getBeanNamesForType with reified type parameters and Boolean`() {
|
||||||
lbf.getBeanNamesForType<Foo>(false)
|
lbf.getBeanNamesForType<Foo>(false)
|
||||||
Mockito.verify(lbf, Mockito.times(1)).getBeanNamesForType(Foo::class.java, false , true)
|
verify(lbf, times(1)).getBeanNamesForType(Foo::class.java, false , true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `getBeanNamesForType with reified type parameters, Boolean and Boolean`() {
|
fun `getBeanNamesForType with reified type parameters, Boolean and Boolean`() {
|
||||||
lbf.getBeanNamesForType<Foo>(false, false)
|
lbf.getBeanNamesForType<Foo>(false, false)
|
||||||
Mockito.verify(lbf, Mockito.times(1)).getBeanNamesForType(Foo::class.java, false , false)
|
verify(lbf, times(1)).getBeanNamesForType(Foo::class.java, false , false)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `getBeansOfType with KClass`() {
|
fun `getBeansOfType with KClass`() {
|
||||||
lbf.getBeansOfType(Foo::class)
|
lbf.getBeansOfType(Foo::class)
|
||||||
Mockito.verify(lbf, Mockito.times(1)).getBeansOfType(Foo::class.java, true , true)
|
verify(lbf, times(1)).getBeansOfType(Foo::class.java, true , true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `getBeansOfType with KClass and Boolean`() {
|
fun `getBeansOfType with KClass and Boolean`() {
|
||||||
lbf.getBeansOfType(Foo::class, false)
|
lbf.getBeansOfType(Foo::class, false)
|
||||||
Mockito.verify(lbf, Mockito.times(1)).getBeansOfType(Foo::class.java, false , true)
|
verify(lbf, times(1)).getBeansOfType(Foo::class.java, false , true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `getBeansOfType with KClass, Boolean and Boolean`() {
|
fun `getBeansOfType with KClass, Boolean and Boolean`() {
|
||||||
lbf.getBeansOfType(Foo::class, false, false)
|
lbf.getBeansOfType(Foo::class, false, false)
|
||||||
Mockito.verify(lbf, Mockito.times(1)).getBeansOfType(Foo::class.java, false , false)
|
verify(lbf, times(1)).getBeansOfType(Foo::class.java, false , false)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `getBeansOfType with reified type parameters`() {
|
fun `getBeansOfType with reified type parameters`() {
|
||||||
lbf.getBeansOfType<Foo>()
|
lbf.getBeansOfType<Foo>()
|
||||||
Mockito.verify(lbf, Mockito.times(1)).getBeansOfType(Foo::class.java, true , true)
|
verify(lbf, times(1)).getBeansOfType(Foo::class.java, true , true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `getBeansOfType with reified type parameters and Boolean`() {
|
fun `getBeansOfType with reified type parameters and Boolean`() {
|
||||||
lbf.getBeansOfType<Foo>(false)
|
lbf.getBeansOfType<Foo>(false)
|
||||||
Mockito.verify(lbf, Mockito.times(1)).getBeansOfType(Foo::class.java, false , true)
|
verify(lbf, times(1)).getBeansOfType(Foo::class.java, false , true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `getBeansOfType with reified type parameters, Boolean and Boolean`() {
|
fun `getBeansOfType with reified type parameters, Boolean and Boolean`() {
|
||||||
lbf.getBeansOfType<Foo>(false, false)
|
lbf.getBeansOfType<Foo>(false, false)
|
||||||
Mockito.verify(lbf, Mockito.times(1)).getBeansOfType(Foo::class.java, false , false)
|
verify(lbf, times(1)).getBeansOfType(Foo::class.java, false , false)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `getBeanNamesForAnnotation with KClass`() {
|
fun `getBeanNamesForAnnotation with KClass`() {
|
||||||
lbf.getBeanNamesForAnnotation(Bar::class)
|
lbf.getBeanNamesForAnnotation(Bar::class)
|
||||||
Mockito.verify(lbf, Mockito.times(1)).getBeanNamesForAnnotation(Bar::class.java)
|
verify(lbf, times(1)).getBeanNamesForAnnotation(Bar::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `getBeanNamesForAnnotation with reified type parameters`() {
|
fun `getBeanNamesForAnnotation with reified type parameters`() {
|
||||||
lbf.getBeanNamesForAnnotation<Bar>()
|
lbf.getBeanNamesForAnnotation<Bar>()
|
||||||
Mockito.verify(lbf, Mockito.times(1)).getBeanNamesForAnnotation(Bar::class.java)
|
verify(lbf, times(1)).getBeanNamesForAnnotation(Bar::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `getBeansWithAnnotation with KClass`() {
|
fun `getBeansWithAnnotation with KClass`() {
|
||||||
lbf.getBeansWithAnnotation(Bar::class)
|
lbf.getBeansWithAnnotation(Bar::class)
|
||||||
Mockito.verify(lbf, Mockito.times(1)).getBeansWithAnnotation(Bar::class.java)
|
verify(lbf, times(1)).getBeansWithAnnotation(Bar::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `getBeansWithAnnotation with reified type parameters`() {
|
fun `getBeansWithAnnotation with reified type parameters`() {
|
||||||
lbf.getBeansWithAnnotation<Bar>()
|
lbf.getBeansWithAnnotation<Bar>()
|
||||||
Mockito.verify(lbf, Mockito.times(1)).getBeansWithAnnotation(Bar::class.java)
|
verify(lbf, times(1)).getBeansWithAnnotation(Bar::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `findAnnotationOnBean with String and KClass`() {
|
fun `findAnnotationOnBean with String and KClass`() {
|
||||||
val name = "bar"
|
val name = "bar"
|
||||||
lbf.findAnnotationOnBean(name, Bar::class)
|
lbf.findAnnotationOnBean(name, Bar::class)
|
||||||
Mockito.verify(lbf, Mockito.times(1)).findAnnotationOnBean(name, Bar::class.java)
|
verify(lbf, times(1)).findAnnotationOnBean(name, Bar::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `findAnnotationOnBean with String and reified type parameters`() {
|
fun `findAnnotationOnBean with String and reified type parameters`() {
|
||||||
val name = "bar"
|
val name = "bar"
|
||||||
lbf.findAnnotationOnBean<Bar>(name)
|
lbf.findAnnotationOnBean<Bar>(name)
|
||||||
Mockito.verify(lbf, Mockito.times(1)).findAnnotationOnBean(name, Bar::class.java)
|
verify(lbf, times(1)).findAnnotationOnBean(name, Bar::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
class Foo
|
class Foo
|
||||||
|
|
|
@ -38,7 +38,7 @@ class KotlinAutowiredTests {
|
||||||
bpp.setBeanFactory(bf)
|
bpp.setBeanFactory(bf)
|
||||||
bf.addBeanPostProcessor(bpp)
|
bf.addBeanPostProcessor(bpp)
|
||||||
var bd = RootBeanDefinition(KotlinBean::class.java)
|
var bd = RootBeanDefinition(KotlinBean::class.java)
|
||||||
bd.setScope(RootBeanDefinition.SCOPE_PROTOTYPE)
|
bd.scope = RootBeanDefinition.SCOPE_PROTOTYPE
|
||||||
bf.registerBeanDefinition("annotatedBean", bd)
|
bf.registerBeanDefinition("annotatedBean", bd)
|
||||||
var tb = TestBean()
|
var tb = TestBean()
|
||||||
bf.registerSingleton("testBean", tb)
|
bf.registerSingleton("testBean", tb)
|
||||||
|
@ -56,7 +56,7 @@ class KotlinAutowiredTests {
|
||||||
bpp.setBeanFactory(bf)
|
bpp.setBeanFactory(bf)
|
||||||
bf.addBeanPostProcessor(bpp)
|
bf.addBeanPostProcessor(bpp)
|
||||||
var bd = RootBeanDefinition(KotlinBean::class.java)
|
var bd = RootBeanDefinition(KotlinBean::class.java)
|
||||||
bd.setScope(RootBeanDefinition.SCOPE_PROTOTYPE)
|
bd.scope = RootBeanDefinition.SCOPE_PROTOTYPE
|
||||||
bf.registerBeanDefinition("annotatedBean", bd)
|
bf.registerBeanDefinition("annotatedBean", bd)
|
||||||
|
|
||||||
var kb = bf.getBean("annotatedBean", KotlinBean::class.java)
|
var kb = bf.getBean("annotatedBean", KotlinBean::class.java)
|
||||||
|
|
|
@ -5,8 +5,7 @@ import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
import org.mockito.Answers
|
import org.mockito.Answers
|
||||||
import org.mockito.Mock
|
import org.mockito.Mock
|
||||||
import org.mockito.Mockito
|
import org.mockito.Mockito.*
|
||||||
import org.mockito.Mockito.verify
|
|
||||||
import org.mockito.junit.MockitoJUnitRunner
|
import org.mockito.junit.MockitoJUnitRunner
|
||||||
import org.springframework.http.HttpEntity
|
import org.springframework.http.HttpEntity
|
||||||
import org.springframework.http.HttpMethod
|
import org.springframework.http.HttpMethod
|
||||||
|
@ -30,7 +29,7 @@ class RestOperationsExtensionsTests {
|
||||||
val var1 = "var1"
|
val var1 = "var1"
|
||||||
val var2 = "var2"
|
val var2 = "var2"
|
||||||
template.getForObject<Foo>(url, var1, var2)
|
template.getForObject<Foo>(url, var1, var2)
|
||||||
verify(template, Mockito.times(1)).getForObject(url, Foo::class.java, var1, var2)
|
verify(template, times(1)).getForObject(url, Foo::class.java, var1, var2)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -38,14 +37,14 @@ class RestOperationsExtensionsTests {
|
||||||
val url = "https://spring.io"
|
val url = "https://spring.io"
|
||||||
val vars = mapOf(Pair("key1", "value1"), Pair("key2", "value2"))
|
val vars = mapOf(Pair("key1", "value1"), Pair("key2", "value2"))
|
||||||
template.getForObject<Foo>(url, vars)
|
template.getForObject<Foo>(url, vars)
|
||||||
verify(template, Mockito.times(1)).getForObject(url, Foo::class.java, vars)
|
verify(template, times(1)).getForObject(url, Foo::class.java, vars)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `getForObject with reified type parameters and URI`() {
|
fun `getForObject with reified type parameters and URI`() {
|
||||||
val url = URI("https://spring.io")
|
val url = URI("https://spring.io")
|
||||||
template.getForObject<Foo>(url)
|
template.getForObject<Foo>(url)
|
||||||
verify(template, Mockito.times(1)).getForObject(url, Foo::class.java)
|
verify(template, times(1)).getForObject(url, Foo::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -54,7 +53,7 @@ class RestOperationsExtensionsTests {
|
||||||
val var1 = "var1"
|
val var1 = "var1"
|
||||||
val var2 = "var2"
|
val var2 = "var2"
|
||||||
template.getForEntity<Foo>(url, var1, var2)
|
template.getForEntity<Foo>(url, var1, var2)
|
||||||
verify(template, Mockito.times(1)).getForEntity(url, Foo::class.java, var1, var2)
|
verify(template, times(1)).getForEntity(url, Foo::class.java, var1, var2)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -64,7 +63,7 @@ class RestOperationsExtensionsTests {
|
||||||
val var1 = "var1"
|
val var1 = "var1"
|
||||||
val var2 = "var2"
|
val var2 = "var2"
|
||||||
template.postForObject<Foo>(url, body, var1, var2)
|
template.postForObject<Foo>(url, body, var1, var2)
|
||||||
verify(template, Mockito.times(1)).postForObject(url, body, Foo::class.java, var1, var2)
|
verify(template, times(1)).postForObject(url, body, Foo::class.java, var1, var2)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -73,7 +72,7 @@ class RestOperationsExtensionsTests {
|
||||||
val body: Any = "body"
|
val body: Any = "body"
|
||||||
val vars = mapOf(Pair("key1", "value1"), Pair("key2", "value2"))
|
val vars = mapOf(Pair("key1", "value1"), Pair("key2", "value2"))
|
||||||
template.postForObject<Foo>(url, body, vars)
|
template.postForObject<Foo>(url, body, vars)
|
||||||
verify(template, Mockito.times(1)).postForObject(url, body, Foo::class.java, vars)
|
verify(template, times(1)).postForObject(url, body, Foo::class.java, vars)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -81,7 +80,7 @@ class RestOperationsExtensionsTests {
|
||||||
val url = "https://spring.io"
|
val url = "https://spring.io"
|
||||||
val body: Any = "body"
|
val body: Any = "body"
|
||||||
template.postForObject<Foo>(url, body)
|
template.postForObject<Foo>(url, body)
|
||||||
verify(template, Mockito.times(1)).postForObject(url, body, Foo::class.java)
|
verify(template, times(1)).postForObject(url, body, Foo::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -91,7 +90,7 @@ class RestOperationsExtensionsTests {
|
||||||
val var1 = "var1"
|
val var1 = "var1"
|
||||||
val var2 = "var2"
|
val var2 = "var2"
|
||||||
template.postForEntity<Foo>(url, body, var1, var2)
|
template.postForEntity<Foo>(url, body, var1, var2)
|
||||||
verify(template, Mockito.times(1)).postForEntity(url, body, Foo::class.java, var1, var2)
|
verify(template, times(1)).postForEntity(url, body, Foo::class.java, var1, var2)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -100,7 +99,7 @@ class RestOperationsExtensionsTests {
|
||||||
val body: Any = "body"
|
val body: Any = "body"
|
||||||
val vars = mapOf(Pair("key1", "value1"), Pair("key2", "value2"))
|
val vars = mapOf(Pair("key1", "value1"), Pair("key2", "value2"))
|
||||||
template.postForEntity<Foo>(url, body, vars)
|
template.postForEntity<Foo>(url, body, vars)
|
||||||
verify(template, Mockito.times(1)).postForEntity(url, body, Foo::class.java, vars)
|
verify(template, times(1)).postForEntity(url, body, Foo::class.java, vars)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -108,7 +107,7 @@ class RestOperationsExtensionsTests {
|
||||||
val url = "https://spring.io"
|
val url = "https://spring.io"
|
||||||
val body: Any = "body"
|
val body: Any = "body"
|
||||||
template.postForEntity<Foo>(url, body)
|
template.postForEntity<Foo>(url, body)
|
||||||
verify(template, Mockito.times(1)).postForEntity(url, body, Foo::class.java)
|
verify(template, times(1)).postForEntity(url, body, Foo::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -119,7 +118,7 @@ class RestOperationsExtensionsTests {
|
||||||
val var1 = "var1"
|
val var1 = "var1"
|
||||||
val var2 = "var2"
|
val var2 = "var2"
|
||||||
template.exchange<Foo>(url, method, entity, var1, var2)
|
template.exchange<Foo>(url, method, entity, var1, var2)
|
||||||
verify(template, Mockito.times(1)).exchange(url, method, entity, Foo::class.java, var1, var2)
|
verify(template, times(1)).exchange(url, method, entity, Foo::class.java, var1, var2)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -129,7 +128,7 @@ class RestOperationsExtensionsTests {
|
||||||
val entity = mock<HttpEntity<Foo>>()
|
val entity = mock<HttpEntity<Foo>>()
|
||||||
val vars = mapOf(Pair("key1", "value1"), Pair("key2", "value2"))
|
val vars = mapOf(Pair("key1", "value1"), Pair("key2", "value2"))
|
||||||
template.exchange<Foo>(url, method, entity, vars)
|
template.exchange<Foo>(url, method, entity, vars)
|
||||||
verify(template, Mockito.times(1)).exchange(url, method, entity, Foo::class.java, vars)
|
verify(template, times(1)).exchange(url, method, entity, Foo::class.java, vars)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -138,15 +137,14 @@ class RestOperationsExtensionsTests {
|
||||||
val method = HttpMethod.GET
|
val method = HttpMethod.GET
|
||||||
val entity = mock<HttpEntity<Foo>>()
|
val entity = mock<HttpEntity<Foo>>()
|
||||||
template.exchange<Foo>(url, method, entity)
|
template.exchange<Foo>(url, method, entity)
|
||||||
verify(template, Mockito.times(1)).exchange(url, method, entity, Foo::class.java)
|
verify(template, times(1)).exchange(url, method, entity, Foo::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `exchange with reified type parameters, String, HttpEntity`() {
|
fun `exchange with reified type parameters, String, HttpEntity`() {
|
||||||
val url = "https://spring.io"
|
|
||||||
val entity = mock<RequestEntity<Foo>>()
|
val entity = mock<RequestEntity<Foo>>()
|
||||||
template.exchange<Foo>(entity)
|
template.exchange<Foo>(entity)
|
||||||
verify(template, Mockito.times(1)).exchange(entity, Foo::class.java)
|
verify(template, times(1)).exchange(entity, Foo::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
class Foo
|
class Foo
|
||||||
|
|
|
@ -4,8 +4,7 @@ import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
import org.mockito.Answers
|
import org.mockito.Answers
|
||||||
import org.mockito.Mock
|
import org.mockito.Mock
|
||||||
import org.mockito.Mockito
|
import org.mockito.Mockito.*
|
||||||
import org.mockito.Mockito.verify
|
|
||||||
import org.mockito.junit.MockitoJUnitRunner
|
import org.mockito.junit.MockitoJUnitRunner
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -22,25 +21,25 @@ class ClientResponseExtensionsTests {
|
||||||
@Test
|
@Test
|
||||||
fun `bodyToMono with KClass`() {
|
fun `bodyToMono with KClass`() {
|
||||||
response.bodyToMono(Foo::class)
|
response.bodyToMono(Foo::class)
|
||||||
verify(response, Mockito.times(1)).bodyToMono(Foo::class.java)
|
verify(response, times(1)).bodyToMono(Foo::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `bodyToMono with reified type parameters`() {
|
fun `bodyToMono with reified type parameters`() {
|
||||||
response.bodyToMono<Foo>()
|
response.bodyToMono<Foo>()
|
||||||
verify(response, Mockito.times(1)).bodyToMono(Foo::class.java)
|
verify(response, times(1)).bodyToMono(Foo::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `bodyToFlux with KClass`() {
|
fun `bodyToFlux with KClass`() {
|
||||||
response.bodyToFlux(Foo::class)
|
response.bodyToFlux(Foo::class)
|
||||||
verify(response, Mockito.times(1)).bodyToFlux(Foo::class.java)
|
verify(response, times(1)).bodyToFlux(Foo::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `bodyToFlux with reified type parameters`() {
|
fun `bodyToFlux with reified type parameters`() {
|
||||||
response.bodyToFlux<Foo>()
|
response.bodyToFlux<Foo>()
|
||||||
verify(response, Mockito.times(1)).bodyToFlux(Foo::class.java)
|
verify(response, times(1)).bodyToFlux(Foo::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
class Foo
|
class Foo
|
||||||
|
|
|
@ -5,8 +5,7 @@ import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
import org.mockito.Answers
|
import org.mockito.Answers
|
||||||
import org.mockito.Mock
|
import org.mockito.Mock
|
||||||
import org.mockito.Mockito
|
import org.mockito.Mockito.*
|
||||||
import org.mockito.Mockito.verify
|
|
||||||
import org.mockito.junit.MockitoJUnitRunner
|
import org.mockito.junit.MockitoJUnitRunner
|
||||||
import org.reactivestreams.Publisher
|
import org.reactivestreams.Publisher
|
||||||
|
|
||||||
|
@ -29,55 +28,55 @@ class WebClientExtensionsTests {
|
||||||
fun `RequestBodySpec#body with Publisher and reified type parameters`() {
|
fun `RequestBodySpec#body with Publisher and reified type parameters`() {
|
||||||
val body = mock<Publisher<Foo>>()
|
val body = mock<Publisher<Foo>>()
|
||||||
requestBodySpec.body(body)
|
requestBodySpec.body(body)
|
||||||
verify(requestBodySpec, Mockito.times(1)).body(body, Foo::class.java)
|
verify(requestBodySpec, times(1)).body(body, Foo::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `ResponseSpec#bodyToMono with KClass`() {
|
fun `ResponseSpec#bodyToMono with KClass`() {
|
||||||
responseSpec.bodyToMono(Foo::class)
|
responseSpec.bodyToMono(Foo::class)
|
||||||
verify(responseSpec, Mockito.times(1)).bodyToMono(Foo::class.java)
|
verify(responseSpec, times(1)).bodyToMono(Foo::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `ResponseSpec#bodyToMono with reified type parameters`() {
|
fun `ResponseSpec#bodyToMono with reified type parameters`() {
|
||||||
responseSpec.bodyToMono<Foo>()
|
responseSpec.bodyToMono<Foo>()
|
||||||
verify(responseSpec, Mockito.times(1)).bodyToMono(Foo::class.java)
|
verify(responseSpec, times(1)).bodyToMono(Foo::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `ResponseSpec#bodyToFlux with KClass`() {
|
fun `ResponseSpec#bodyToFlux with KClass`() {
|
||||||
responseSpec.bodyToFlux(Foo::class)
|
responseSpec.bodyToFlux(Foo::class)
|
||||||
verify(responseSpec, Mockito.times(1)).bodyToFlux(Foo::class.java)
|
verify(responseSpec, times(1)).bodyToFlux(Foo::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `ResponseSpec#bodyToFlux with reified type parameters`() {
|
fun `ResponseSpec#bodyToFlux with reified type parameters`() {
|
||||||
responseSpec.bodyToFlux<Foo>()
|
responseSpec.bodyToFlux<Foo>()
|
||||||
verify(responseSpec, Mockito.times(1)).bodyToFlux(Foo::class.java)
|
verify(responseSpec, times(1)).bodyToFlux(Foo::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `ResponseSpec#toEntity with KClass`() {
|
fun `ResponseSpec#toEntity with KClass`() {
|
||||||
responseSpec.toEntity(Foo::class)
|
responseSpec.toEntity(Foo::class)
|
||||||
verify(responseSpec, Mockito.times(1)).toEntity(Foo::class.java)
|
verify(responseSpec, times(1)).toEntity(Foo::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `ResponseSpec#toEntity with reified type parameters`() {
|
fun `ResponseSpec#toEntity with reified type parameters`() {
|
||||||
responseSpec.toEntity<Foo>()
|
responseSpec.toEntity<Foo>()
|
||||||
verify(responseSpec, Mockito.times(1)).toEntity(Foo::class.java)
|
verify(responseSpec, times(1)).toEntity(Foo::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `ResponseSpec#toEntityList with KClass`() {
|
fun `ResponseSpec#toEntityList with KClass`() {
|
||||||
responseSpec.toEntityList(Foo::class)
|
responseSpec.toEntityList(Foo::class)
|
||||||
verify(responseSpec, Mockito.times(1)).toEntityList(Foo::class.java)
|
verify(responseSpec, times(1)).toEntityList(Foo::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `ResponseSpec#toEntityList with reified type parameters`() {
|
fun `ResponseSpec#toEntityList with reified type parameters`() {
|
||||||
responseSpec.toEntityList<Foo>()
|
responseSpec.toEntityList<Foo>()
|
||||||
verify(responseSpec, Mockito.times(1)).toEntityList(Foo::class.java)
|
verify(responseSpec, times(1)).toEntityList(Foo::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
class Foo
|
class Foo
|
||||||
|
|
|
@ -4,8 +4,7 @@ import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
import org.mockito.Answers
|
import org.mockito.Answers
|
||||||
import org.mockito.Mock
|
import org.mockito.Mock
|
||||||
import org.mockito.Mockito
|
import org.mockito.Mockito.*
|
||||||
import org.mockito.Mockito.verify
|
|
||||||
import org.mockito.junit.MockitoJUnitRunner
|
import org.mockito.junit.MockitoJUnitRunner
|
||||||
import org.springframework.web.reactive.function.server.ServerRequest
|
import org.springframework.web.reactive.function.server.ServerRequest
|
||||||
import org.springframework.web.reactive.function.server.bodyToFlux
|
import org.springframework.web.reactive.function.server.bodyToFlux
|
||||||
|
@ -25,25 +24,25 @@ class ServerRequestExtensionsTests {
|
||||||
@Test
|
@Test
|
||||||
fun `bodyToMono with KClass`() {
|
fun `bodyToMono with KClass`() {
|
||||||
request.bodyToMono(Foo::class)
|
request.bodyToMono(Foo::class)
|
||||||
verify(request, Mockito.times(1)).bodyToMono(Foo::class.java)
|
verify(request, times(1)).bodyToMono(Foo::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `bodyToMono with reified type parameters`() {
|
fun `bodyToMono with reified type parameters`() {
|
||||||
request.bodyToMono<Foo>()
|
request.bodyToMono<Foo>()
|
||||||
verify(request, Mockito.times(1)).bodyToMono(Foo::class.java)
|
verify(request, times(1)).bodyToMono(Foo::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `bodyToFlux with KClass`() {
|
fun `bodyToFlux with KClass`() {
|
||||||
request.bodyToFlux(Foo::class)
|
request.bodyToFlux(Foo::class)
|
||||||
verify(request, Mockito.times(1)).bodyToFlux(Foo::class.java)
|
verify(request, times(1)).bodyToFlux(Foo::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `bodyToFlux with reified type parameters`() {
|
fun `bodyToFlux with reified type parameters`() {
|
||||||
request.bodyToFlux<Foo>()
|
request.bodyToFlux<Foo>()
|
||||||
verify(request, Mockito.times(1)).bodyToFlux(Foo::class.java)
|
verify(request, times(1)).bodyToFlux(Foo::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
class Foo
|
class Foo
|
||||||
|
|
|
@ -5,7 +5,7 @@ import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
import org.mockito.Answers
|
import org.mockito.Answers
|
||||||
import org.mockito.Mock
|
import org.mockito.Mock
|
||||||
import org.mockito.Mockito
|
import org.mockito.Mockito.*
|
||||||
import org.mockito.junit.MockitoJUnitRunner
|
import org.mockito.junit.MockitoJUnitRunner
|
||||||
import org.reactivestreams.Publisher
|
import org.reactivestreams.Publisher
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ class ServerResponseExtensionsTests {
|
||||||
fun `BodyBuilder#body with Publisher and reified type parameters`() {
|
fun `BodyBuilder#body with Publisher and reified type parameters`() {
|
||||||
val body = mock<Publisher<Foo>>()
|
val body = mock<Publisher<Foo>>()
|
||||||
bodyBuilder.body(body)
|
bodyBuilder.body(body)
|
||||||
Mockito.verify(bodyBuilder, Mockito.times(1)).body(body, Foo::class.java)
|
verify(bodyBuilder, times(1)).body(body, Foo::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
class Foo
|
class Foo
|
||||||
|
|
Loading…
Reference in New Issue