-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Filter selfReferenceRequests to minimal needed
- Loading branch information
1 parent
1776b59
commit 770dcb0
Showing
6 changed files
with
67 additions
and
14 deletions.
There are no files selected for viewing
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
31 changes: 31 additions & 0 deletions
31
annotation-processor/src/test/kotlin/pl/touk/krush/model/DFSTest.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 pl.touk.krush.model | ||
|
||
import com.squareup.kotlinpoet.metadata.KotlinPoetMetadataPreview | ||
import org.assertj.core.api.Assertions.assertThat | ||
import org.junit.jupiter.api.Test | ||
import pl.touk.krush.AnnotationProcessorTest | ||
import javax.lang.model.util.Elements | ||
import javax.lang.model.util.Types | ||
|
||
@KotlinPoetMetadataPreview | ||
class DFSTest(types: Types, elements: Elements) : AnnotationProcessorTest(types, elements), EntityGraphSampleData { | ||
|
||
@Test | ||
fun shouldVisitAllNodesUsingDFS() { | ||
//given | ||
val graphBuilder = oneToOneGraphBuilder(getTypeEnv()) | ||
|
||
//when | ||
val graphs = graphBuilder.build() | ||
val typeElement = oneToOneSourceEntity(getTypeEnv()) | ||
|
||
val elements = DFS(graphs).visit(typeElement) | ||
|
||
//then | ||
assertThat(elements) | ||
.hasSize(2) | ||
.extracting("type") | ||
.containsOnly(typeElement, oneToOneTargetEntity(getTypeEnv())) | ||
} | ||
|
||
} |
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