"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "spring-core/src/test/kotlin/org/springframework/core/KotlinBridgeMethodResolverTests.kt" between
spring-framework-5.3.23.tar.gz and spring-framework-5.3.24.tar.gz

About: Spring Framework is an application framework for the Java platform and .NET Framework. Community edition.

KotlinBridgeMethodResolverTests.kt  (spring-framework-5.3.23):KotlinBridgeMethodResolverTests.kt  (spring-framework-5.3.24)
/* /*
* Copyright 2002-2021 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.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* https://www.apache.org/licenses/LICENSE-2.0 * https://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.core package org.springframework.core
import org.assertj.core.api.Assertions import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
class KotlinBridgeMethodResolverTests { class KotlinBridgeMethodResolverTests {
@Test @Test
fun findBridgedMethod() { fun findBridgedMethod() {
val unbridged = GenericRepository::class.java.getDeclaredMethod(" delete", Int::class.java) val unbridged = GenericRepository::class.java.getDeclaredMethod(" delete", Int::class.java)
val bridged = GenericRepository::class.java.getDeclaredMethod("de lete", Any::class.java) val bridged = GenericRepository::class.java.getDeclaredMethod("de lete", Any::class.java)
Assertions.assertThat(unbridged.isBridge).isFalse assertThat(unbridged.isBridge).isFalse
Assertions.assertThat(bridged.isBridge).isTrue assertThat(bridged.isBridge).isTrue
Assertions.assertThat(BridgeMethodResolver.findBridgedMethod(unbr assertThat(BridgeMethodResolver.findBridgedMethod(unbridged)).`as
idged)).`as`("Unbridged method not returned directly").isEqualTo(unbridged) `("Unbridged method not returned directly").isEqualTo(unbridged)
Assertions.assertThat(BridgeMethodResolver.findBridgedMethod(brid assertThat(BridgeMethodResolver.findBridgedMethod(bridged)).`as`(
ged)).`as`("Incorrect bridged method returned").isEqualTo(unbridged) "Incorrect bridged method returned").isEqualTo(unbridged)
} }
@Test @Test
fun findBridgedMethodWithArrays() { fun findBridgedMethodWithArrays() {
val unbridged = GenericRepository::class.java.getDeclaredMethod(" delete", Array<Int>::class.java) val unbridged = GenericRepository::class.java.getDeclaredMethod(" delete", Array<Int>::class.java)
val bridged = GenericRepository::class.java.getDeclaredMethod("de lete", Array<Any>::class.java) val bridged = GenericRepository::class.java.getDeclaredMethod("de lete", Array<Any>::class.java)
Assertions.assertThat(unbridged.isBridge).isFalse assertThat(unbridged.isBridge).isFalse
Assertions.assertThat(bridged.isBridge).isTrue assertThat(bridged.isBridge).isTrue
Assertions.assertThat(BridgeMethodResolver.findBridgedMethod(unbr assertThat(BridgeMethodResolver.findBridgedMethod(unbridged)).`as
idged)).`as`("Unbridged method not returned directly").isEqualTo(unbridged) `("Unbridged method not returned directly").isEqualTo(unbridged)
Assertions.assertThat(BridgeMethodResolver.findBridgedMethod(brid assertThat(BridgeMethodResolver.findBridgedMethod(bridged)).`as`(
ged)).`as`("Incorrect bridged method returned").isEqualTo(unbridged) "Incorrect bridged method returned").isEqualTo(unbridged)
} }
} }
interface GenericInterface<ID> { interface GenericInterface<ID> {
fun delete(id: ID) fun delete(id: ID)
fun delete(ids: Array<ID>) fun delete(ids: Array<ID>)
} }
abstract class AbstractGenericClass<ID> : GenericInterface<ID> { abstract class AbstractGenericClass<ID> : GenericInterface<ID> {
 End of changes. 6 change blocks. 
14 lines changed or deleted 14 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)