-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
177 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
core/src/test/kotlin/org/jetbrains/academy/test/system/core/AbbreviationTests.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package org.jetbrains.academy.test.system.core | ||
|
||
import org.jetbrains.academy.test.system.core.models.classes.TestClass | ||
import org.jetbrains.academy.test.system.core.testData.abbreviation.* | ||
import org.junit.jupiter.params.ParameterizedTest | ||
import org.junit.jupiter.params.provider.MethodSource | ||
import org.junit.jupiter.params.provider.Arguments | ||
|
||
class AbbreviationTests { | ||
companion object { | ||
@JvmStatic | ||
fun testData() = listOf( | ||
Arguments.of(withNullableTestClass), | ||
Arguments.of(withTypeAliasTestClass), | ||
Arguments.of(withGenericTypeAliasTestClass), | ||
Arguments.of(withDoubleTypeAliasTestClass), | ||
Arguments.of(withNullableGenericParametersTestClass) | ||
) | ||
} | ||
|
||
@ParameterizedTest | ||
@MethodSource("testData") | ||
fun testAbbreviation(testClass: TestClass) { | ||
val clazz = testClass.checkBaseDefinition() | ||
testClass.checkFieldsDefinition(clazz) | ||
testClass.checkDeclaredMethods(clazz) | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
...otlin/org/jetbrains/academy/test/system/core/testData/abbreviation/WithDoubleTypeAlias.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.jetbrains.academy.test.system.core.testData.abbreviation | ||
|
||
import org.jetbrains.academy.test.system.core.models.TestKotlinType | ||
import org.jetbrains.academy.test.system.core.models.Visibility | ||
import org.jetbrains.academy.test.system.core.models.classes.TestClass | ||
import org.jetbrains.academy.test.system.core.models.variable.TestVariable | ||
import org.jetbrains.academy.test.system.core.models.variable.VariableMutability | ||
|
||
val identifierMapKotlinType = TestKotlinType( | ||
"Map", | ||
"kotlin.collections.Map<org.jetbrains.academy.test.system.core.testData.abbreviation.Identifier, org.jetbrains.academy.test.system.core.testData.abbreviation.Identifier>" | ||
) | ||
|
||
val withDoubleTypeAliasTestClass = TestClass( | ||
"WithDoubleTypeAlias", | ||
"org.jetbrains.academy.test.system.core.testData.abbreviation", | ||
declaredFields = listOf( | ||
TestVariable( | ||
name = "value", | ||
javaType = "Map", | ||
kotlinType = identifierMapKotlinType, | ||
visibility = Visibility.PUBLIC, | ||
mutability = VariableMutability.VAL | ||
) | ||
) | ||
) | ||
|
||
typealias Identifier = Int | ||
|
||
@Suppress("unused") | ||
data class WithDoubleTypeAlias(val value: Map<Identifier, Identifier>) |
31 changes: 31 additions & 0 deletions
31
...tlin/org/jetbrains/academy/test/system/core/testData/abbreviation/WithGenericTypeAlias.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.jetbrains.academy.test.system.core.testData.abbreviation | ||
|
||
import org.jetbrains.academy.test.system.core.models.TestKotlinType | ||
import org.jetbrains.academy.test.system.core.models.Visibility | ||
import org.jetbrains.academy.test.system.core.models.classes.TestClass | ||
import org.jetbrains.academy.test.system.core.models.variable.TestVariable | ||
import org.jetbrains.academy.test.system.core.models.variable.VariableMutability | ||
|
||
val dictionaryTestKotlinType = TestKotlinType( | ||
"Map<String, String>", | ||
"org.jetbrains.academy.test.system.core.testData.abbreviation.Dictionary<kotlin.String>" | ||
) | ||
|
||
val withGenericTypeAliasTestClass = TestClass( | ||
"WithGenericTypeAlias", | ||
"org.jetbrains.academy.test.system.core.testData.abbreviation", | ||
declaredFields = listOf( | ||
TestVariable( | ||
name = "value", | ||
javaType = "Map", | ||
kotlinType = dictionaryTestKotlinType, | ||
visibility = Visibility.PUBLIC, | ||
mutability = VariableMutability.VAL | ||
) | ||
) | ||
) | ||
|
||
typealias Dictionary<T> = Map<String, T> | ||
|
||
@Suppress("unused") | ||
data class WithGenericTypeAlias(val value: Dictionary<String>) |
27 changes: 27 additions & 0 deletions
27
.../test/kotlin/org/jetbrains/academy/test/system/core/testData/abbreviation/WithNullable.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package org.jetbrains.academy.test.system.core.testData.abbreviation | ||
|
||
import org.jetbrains.academy.test.system.core.models.TestKotlinType | ||
import org.jetbrains.academy.test.system.core.models.Visibility | ||
import org.jetbrains.academy.test.system.core.models.classes.TestClass | ||
import org.jetbrains.academy.test.system.core.models.variable.TestVariable | ||
import org.jetbrains.academy.test.system.core.models.variable.VariableMutability | ||
|
||
val withNullableTestClass = TestClass( | ||
"WithNullable", | ||
"org.jetbrains.academy.test.system.core.testData.abbreviation", | ||
declaredFields = listOf( | ||
TestVariable( | ||
name = "name", | ||
javaType = "String", | ||
kotlinType = TestKotlinType("String?", | ||
"kotlin.String", | ||
isNullable = true | ||
), | ||
visibility = Visibility.PUBLIC, | ||
mutability = VariableMutability.VAL | ||
) | ||
) | ||
) | ||
|
||
@Suppress("unused") | ||
data class WithNullable(val name: String?) |
29 changes: 29 additions & 0 deletions
29
...jetbrains/academy/test/system/core/testData/abbreviation/WithNullableGenericParameters.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package org.jetbrains.academy.test.system.core.testData.abbreviation | ||
|
||
import org.jetbrains.academy.test.system.core.models.TestKotlinType | ||
import org.jetbrains.academy.test.system.core.models.Visibility | ||
import org.jetbrains.academy.test.system.core.models.classes.TestClass | ||
import org.jetbrains.academy.test.system.core.models.variable.TestVariable | ||
import org.jetbrains.academy.test.system.core.models.variable.VariableMutability | ||
|
||
val nullableStringMapKotlinType = TestKotlinType( | ||
"Map", | ||
"kotlin.collections.Map<kotlin.String, kotlin.String>", | ||
) | ||
|
||
val withNullableGenericParametersTestClass = TestClass( | ||
"WithNullableGenericParameters", | ||
"org.jetbrains.academy.test.system.core.testData.abbreviation", | ||
declaredFields = listOf( | ||
TestVariable( | ||
name = "value", | ||
javaType = "Map", | ||
kotlinType = nullableStringMapKotlinType, | ||
visibility = Visibility.PUBLIC, | ||
mutability = VariableMutability.VAL | ||
) | ||
) | ||
) | ||
|
||
@Suppress("unused") | ||
data class WithNullableGenericParameters(val value: Map<String?, String?>) |
31 changes: 31 additions & 0 deletions
31
...test/kotlin/org/jetbrains/academy/test/system/core/testData/abbreviation/WithTypeAlias.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.jetbrains.academy.test.system.core.testData.abbreviation | ||
|
||
import org.jetbrains.academy.test.system.core.models.TestKotlinType | ||
import org.jetbrains.academy.test.system.core.models.Visibility | ||
import org.jetbrains.academy.test.system.core.models.classes.TestClass | ||
import org.jetbrains.academy.test.system.core.models.variable.TestVariable | ||
import org.jetbrains.academy.test.system.core.models.variable.VariableMutability | ||
|
||
val typeAliasTestKotlinType = TestKotlinType( | ||
"String", | ||
"org.jetbrains.academy.test.system.core.testData.abbreviation.TypeAlias" | ||
) | ||
|
||
val withTypeAliasTestClass = TestClass( | ||
"WithTypeAlias", | ||
"org.jetbrains.academy.test.system.core.testData.abbreviation", | ||
declaredFields = listOf( | ||
TestVariable( | ||
name = "name", | ||
javaType = "String", | ||
kotlinType = typeAliasTestKotlinType, | ||
visibility = Visibility.PUBLIC, | ||
mutability = VariableMutability.VAL | ||
) | ||
) | ||
) | ||
|
||
typealias TypeAlias = String | ||
|
||
@Suppress("unused") | ||
data class WithTypeAlias(val name: TypeAlias) |