mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Merge branch '2.7.x'
Closes gh-32510
This commit is contained in:
commit
f6f545dbf1
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -18,7 +18,7 @@ package org.springframework.boot.test.web.client
|
|||||||
|
|
||||||
import io.mockk.mockk
|
import io.mockk.mockk
|
||||||
import io.mockk.verify
|
import io.mockk.verify
|
||||||
import org.junit.Assert
|
import org.assertj.core.api.Assertions.assertThat
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.springframework.core.ParameterizedTypeReference
|
import org.springframework.core.ParameterizedTypeReference
|
||||||
import org.springframework.http.HttpEntity
|
import org.springframework.http.HttpEntity
|
||||||
@ -251,9 +251,9 @@ class TestRestTemplateExtensionsTests {
|
|||||||
.apply { addAll(method.parameterTypes.filter { it != kClass.java }) }
|
.apply { addAll(method.parameterTypes.filter { it != kClass.java }) }
|
||||||
val f = extensions.getDeclaredMethod(method.name,
|
val f = extensions.getDeclaredMethod(method.name,
|
||||||
*parameters.toTypedArray()).kotlinFunction!!
|
*parameters.toTypedArray()).kotlinFunction!!
|
||||||
Assert.assertEquals(1, f.typeParameters.size)
|
assertThat(f.typeParameters.size).isEqualTo(1)
|
||||||
Assert.assertEquals(listOf(Any::class.createType()),
|
assertThat(listOf(Any::class.createType()))
|
||||||
f.typeParameters[0].upperBounds)
|
.isEqualTo(f.typeParameters[0].upperBounds)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2017 the original author or authors.
|
* Copyright 2002-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -15,10 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.boot
|
package org.springframework.boot
|
||||||
|
|
||||||
import org.junit.Assert.assertArrayEquals
|
import org.assertj.core.api.Assertions.assertThat
|
||||||
import org.junit.Assert.assertEquals
|
|
||||||
import org.junit.Assert.assertNotNull
|
|
||||||
import org.junit.Assert.assertTrue
|
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
import org.springframework.beans.factory.getBean
|
import org.springframework.beans.factory.getBean
|
||||||
@ -37,7 +34,7 @@ class SpringApplicationExtensionsTests {
|
|||||||
@Test
|
@Test
|
||||||
fun `Kotlin runApplication() top level function`() {
|
fun `Kotlin runApplication() top level function`() {
|
||||||
val context = runApplication<ExampleWebConfig>()
|
val context = runApplication<ExampleWebConfig>()
|
||||||
assertNotNull(context)
|
assertThat(context).isNotNull
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -46,16 +43,16 @@ class SpringApplicationExtensionsTests {
|
|||||||
val context = runApplication<ExampleWebConfig> {
|
val context = runApplication<ExampleWebConfig> {
|
||||||
setEnvironment(environment)
|
setEnvironment(environment)
|
||||||
}
|
}
|
||||||
assertNotNull(context)
|
assertThat(context).isNotNull
|
||||||
assertEquals(environment, context.environment)
|
assertThat(environment).isEqualTo(context.environment)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Kotlin runApplication(arg1, arg2) top level function`() {
|
fun `Kotlin runApplication(arg1, arg2) top level function`() {
|
||||||
val context = runApplication<ExampleWebConfig>("--debug", "spring", "boot")
|
val context = runApplication<ExampleWebConfig>("--debug", "spring", "boot")
|
||||||
val args = context.getBean<ApplicationArguments>()
|
val args = context.getBean<ApplicationArguments>()
|
||||||
assertArrayEquals(arrayOf("spring", "boot"), args.nonOptionArgs.toTypedArray())
|
assertThat(args.nonOptionArgs.toTypedArray()).containsExactly("spring", "boot")
|
||||||
assertTrue(args.containsOption("debug"))
|
assertThat(args.containsOption("debug")).isEqualTo(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -65,9 +62,9 @@ class SpringApplicationExtensionsTests {
|
|||||||
setEnvironment(environment)
|
setEnvironment(environment)
|
||||||
}
|
}
|
||||||
val args = context.getBean<ApplicationArguments>()
|
val args = context.getBean<ApplicationArguments>()
|
||||||
assertArrayEquals(arrayOf("spring", "boot"), args.nonOptionArgs.toTypedArray())
|
assertThat(args.nonOptionArgs.toTypedArray()).containsExactly("spring", "boot")
|
||||||
assertTrue(args.containsOption("debug"))
|
assertThat(args.containsOption("debug")).isEqualTo(true)
|
||||||
assertEquals(environment, context.environment)
|
assertThat(environment).isEqualTo(context.environment)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Configuration(proxyBeanMethods = false)
|
@Configuration(proxyBeanMethods = false)
|
||||||
|
Loading…
Reference in New Issue
Block a user