Merge branch '2.7.x'

Closes gh-32510
pull/32519/head
Stephane Nicoll 2 years ago
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");
* 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.verify
import org.junit.Assert
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
import org.springframework.core.ParameterizedTypeReference
import org.springframework.http.HttpEntity
@ -251,9 +251,9 @@ class TestRestTemplateExtensionsTests {
.apply { addAll(method.parameterTypes.filter { it != kClass.java }) }
val f = extensions.getDeclaredMethod(method.name,
*parameters.toTypedArray()).kotlinFunction!!
Assert.assertEquals(1, f.typeParameters.size)
Assert.assertEquals(listOf(Any::class.createType()),
f.typeParameters[0].upperBounds)
assertThat(f.typeParameters.size).isEqualTo(1)
assertThat(listOf(Any::class.createType()))
.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");
* you may not use this file except in compliance with the License.
@ -15,10 +15,7 @@
*/
package org.springframework.boot
import org.junit.Assert.assertArrayEquals
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNotNull
import org.junit.Assert.assertTrue
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
import org.springframework.beans.factory.getBean
@ -37,7 +34,7 @@ class SpringApplicationExtensionsTests {
@Test
fun `Kotlin runApplication() top level function`() {
val context = runApplication<ExampleWebConfig>()
assertNotNull(context)
assertThat(context).isNotNull
}
@Test
@ -46,16 +43,16 @@ class SpringApplicationExtensionsTests {
val context = runApplication<ExampleWebConfig> {
setEnvironment(environment)
}
assertNotNull(context)
assertEquals(environment, context.environment)
assertThat(context).isNotNull
assertThat(environment).isEqualTo(context.environment)
}
@Test
fun `Kotlin runApplication(arg1, arg2) top level function`() {
val context = runApplication<ExampleWebConfig>("--debug", "spring", "boot")
val args = context.getBean<ApplicationArguments>()
assertArrayEquals(arrayOf("spring", "boot"), args.nonOptionArgs.toTypedArray())
assertTrue(args.containsOption("debug"))
assertThat(args.nonOptionArgs.toTypedArray()).containsExactly("spring", "boot")
assertThat(args.containsOption("debug")).isEqualTo(true)
}
@Test
@ -65,9 +62,9 @@ class SpringApplicationExtensionsTests {
setEnvironment(environment)
}
val args = context.getBean<ApplicationArguments>()
assertArrayEquals(arrayOf("spring", "boot"), args.nonOptionArgs.toTypedArray())
assertTrue(args.containsOption("debug"))
assertEquals(environment, context.environment)
assertThat(args.nonOptionArgs.toTypedArray()).containsExactly("spring", "boot")
assertThat(args.containsOption("debug")).isEqualTo(true)
assertThat(environment).isEqualTo(context.environment)
}
@Configuration(proxyBeanMethods = false)

Loading…
Cancel
Save