@@ -464,7 +464,6 @@ class KotlinCompilationTests {
464464 }
465465 }
466466
467-
468467 @Test
469468 fun `Kotlin AP sees Java class` () {
470469 val jSource = SourceFile .java(
@@ -649,6 +648,101 @@ class KotlinCompilationTests {
649648 assertThat(result.messages).contains(" non-existing-plugin.jar not found" )
650649 }
651650
651+ @Test
652+ fun `Generated Java source is among generated files list` () {
653+ val kSource = SourceFile .kotlin(
654+ " KSource.kt" , """
655+ package com.tschuchort.compiletesting
656+
657+ @ProcessElem
658+ class KSource {
659+ fun foo() {}
660+ }
661+ """
662+ )
663+
664+ val result = defaultCompilerConfig().apply {
665+ sources = listOf (kSource)
666+ annotationProcessors = listOf (kotlinTestProc)
667+ inheritClassPath = true
668+ }.compile()
669+
670+ assertThat(result.exitCode).isEqualTo(ExitCode .OK )
671+ assertThat(result.generatedFiles.map { it.name }).contains(KotlinTestProcessor .GENERATED_JAVA_CLASS_NAME + " .java" )
672+ }
673+
674+ @Test
675+ fun `Generated Kotlin source is among generated files list` () {
676+ val kSource = SourceFile .kotlin(
677+ " KSource.kt" , """
678+ package com.tschuchort.compiletesting
679+
680+ @ProcessElem
681+ class KSource {
682+ fun foo() {}
683+ }
684+ """
685+ )
686+
687+ val result = defaultCompilerConfig().apply {
688+ sources = listOf (kSource)
689+ annotationProcessors = listOf (kotlinTestProc)
690+ inheritClassPath = true
691+ }.compile()
692+
693+ assertThat(result.exitCode).isEqualTo(ExitCode .OK )
694+ assertThat(result.generatedFiles.map { it.name }).contains(KotlinTestProcessor .GENERATED_KOTLIN_CLASS_NAME + " .kt" )
695+ }
696+
697+ @Test
698+ fun `Compiled Kotlin class file is among generated files list` () {
699+ val kSource = SourceFile .kotlin(
700+ " KSource.kt" , """
701+ package com.tschuchort.compiletesting
702+
703+ @ProcessElem
704+ class KSource {
705+ fun foo() {}
706+ }
707+ """
708+ )
709+
710+ val result = defaultCompilerConfig().apply {
711+ sources = listOf (kSource)
712+ annotationProcessors = listOf (kotlinTestProc)
713+ inheritClassPath = true
714+ }.compile()
715+
716+ assertThat(result.exitCode).isEqualTo(ExitCode .OK )
717+ assertThat(result.generatedFiles.map { it.name }).contains(" KSource.class" )
718+ }
719+
720+ @Test
721+ fun `Compiled Java class file is among generated files list` () {
722+ val jSource = SourceFile .java(
723+ " JSource.java" , """
724+ package com.tschuchort.compiletesting;
725+
726+ @ProcessElem
727+ class JSource {
728+ void foo() {
729+ }
730+ }
731+ """
732+ )
733+
734+ val result = defaultCompilerConfig().apply {
735+ sources = listOf (jSource)
736+ annotationProcessors = listOf (kotlinTestProc)
737+ inheritClassPath = true
738+ }.compile()
739+
740+ assertThat(result.exitCode).isEqualTo(ExitCode .OK )
741+ assertThat(result.generatedFiles.map { it.name }).contains(" JSource.class" )
742+ }
743+
744+
745+
652746 private fun defaultCompilerConfig (): KotlinCompilation {
653747 return KotlinCompilation ().apply {
654748 workingDir = temporaryFolder.root
0 commit comments