-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrated compatibility tests to gradle-plugin (#114)
* Migrated tests from separate projects to the integration tests of gradle-plugin
- Loading branch information
1 parent
be9d2b5
commit 82ac120
Showing
59 changed files
with
617 additions
and
1,750 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -7,6 +7,7 @@ build/ | |
|
||
#Kotlin | ||
.kotlin | ||
kotlin-js-store | ||
|
||
### IntelliJ IDEA ### | ||
.idea | ||
|
4 changes: 2 additions & 2 deletions
4
compiler-plugin/src/main/kotlin/tech/mappie/resolving/ShouldTransformCollector.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
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
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
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
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
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
3 changes: 1 addition & 2 deletions
3
.../testing/configuration/IntegrationTest.kt → ...in/tech/mappie/testing/IntegrationTest.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
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
104 changes: 104 additions & 0 deletions
104
...otlin/tech/mappie/testing/compatibility/java/JavaClassWithConstructorCompatibilityTest.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,104 @@ | ||
package tech.mappie.testing.compatibility.java | ||
|
||
import org.junit.jupiter.api.BeforeEach | ||
import org.junit.jupiter.api.Test | ||
import tech.mappie.testing.TestBase | ||
|
||
class JavaClassWithConstructorCompatibilityTest : TestBase() { | ||
|
||
@BeforeEach | ||
fun setUp() { | ||
java("src/main/java/JavaClass.java", | ||
""" | ||
public class JavaClass { | ||
private String value; | ||
public JavaClass(String value) { | ||
this.value = value; | ||
} | ||
public String getValue() { | ||
return this.value; | ||
} | ||
@Override | ||
public boolean equals(Object obj) { | ||
if (obj == null) return false; | ||
if (obj.getClass() != this.getClass()) return false; | ||
return ((JavaClass) obj).value.equals(this.value); | ||
} | ||
} | ||
""".trimIndent() | ||
) | ||
|
||
kotlin("src/main/kotlin/KotlinClass.kt", | ||
""" | ||
data class KotlinClass(val value: String) | ||
""".trimIndent() | ||
) | ||
} | ||
|
||
@Test | ||
fun `map Java class to Kotlin class via getter`() { | ||
kotlin("src/main/kotlin/Mapper.kt", | ||
""" | ||
import tech.mappie.api.ObjectMappie | ||
object Mapper : ObjectMappie<JavaClass, KotlinClass>() { | ||
override fun map(from: JavaClass) = mapping { | ||
to::value fromValue from.value!! | ||
} | ||
} | ||
""".trimIndent() | ||
) | ||
|
||
kotlin("src/test/kotlin/MapperTest.kt", | ||
""" | ||
import kotlin.test.* | ||
class MapperTest { | ||
@Test | ||
fun test() { | ||
assertEquals( | ||
KotlinClass("value"), | ||
Mapper.map(JavaClass("value")) | ||
) | ||
} | ||
} | ||
""".trimIndent() | ||
) | ||
|
||
runner.withArguments("build").build() | ||
} | ||
|
||
@Test | ||
fun `map Kotlin class to Java class via getter`() { | ||
kotlin("src/main/kotlin/Mapper.kt", | ||
""" | ||
import tech.mappie.api.ObjectMappie | ||
object Mapper : ObjectMappie<KotlinClass, JavaClass>() | ||
""".trimIndent() | ||
) | ||
|
||
kotlin("src/test/kotlin/MapperTest.kt", | ||
""" | ||
import kotlin.test.* | ||
class MapperTest { | ||
@Test | ||
fun test() { | ||
assertEquals( | ||
JavaClass("value"), | ||
Mapper.map(KotlinClass("value")) | ||
) | ||
} | ||
} | ||
""".trimIndent() | ||
) | ||
|
||
runner.withArguments("build").build() | ||
} | ||
} |
Oops, something went wrong.