1 /* 2 * Copyright (C) 2024 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.tools.metalava.model.testsuite.typeitem 18 19 import com.android.tools.metalava.model.testsuite.BaseModelTest 20 import com.android.tools.metalava.testing.kotlin 21 import com.google.common.truth.Truth.assertThat 22 import org.junit.Test 23 24 class CommonTypeAliasTest : BaseModelTest() { 25 26 @Test Test typealias of generic typenull27 fun `Test typealias of generic type`() { 28 runCodebaseTest( 29 kotlin( 30 """ 31 package test.pkg 32 33 class GenericBar<A, B> 34 35 typealias StringIntBar = GenericBar<String?, Int> 36 37 class Foo<T> { 38 fun method(): StringIntBar? = null 39 } 40 """ 41 ), 42 ) { 43 val fooClass = codebase.assertClass("test.pkg.Foo") 44 val method = fooClass.methods().single() 45 assertThat(method.kotlinLikeDescription()) 46 .isEqualTo( 47 "fun method(): test.pkg.GenericBar<java.lang.String?,java.lang.Integer>?" 48 ) 49 } 50 } 51 } 52