Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #119 from viartemev/add-polyadicexpressions-handling
Impl of a feature 121
- Loading branch information
Showing
10 changed files
with
96 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,5 @@ build/ | |
node_modules/ | ||
yarn-error.log | ||
|
||
|
||
### Others ### | ||
### Custom ### | ||
samples/ |
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
9 changes: 9 additions & 0 deletions
9
...tlin/com/viartemev/requestmapper/annotations/extraction/PsiPolyadicExpressionExtractor.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,9 @@ | ||
package com.viartemev.requestmapper.annotations.extraction | ||
|
||
import com.intellij.psi.PsiPolyadicExpression | ||
import com.viartemev.requestmapper.annotations.extraction.PsiExpressionExtractor.extractExpression | ||
|
||
class PsiPolyadicExpressionExtractor : PsiAnnotationValueExtractor<PsiPolyadicExpression> { | ||
|
||
override fun extract(value: PsiPolyadicExpression) = listOf(extractExpression(value)) | ||
} |
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
33 changes: 33 additions & 0 deletions
33
.../com/viartemev/requestmapper/annotations/extraction/PsiPolyadicExpressionExtractorSpek.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,33 @@ | ||
package com.viartemev.requestmapper.annotations.extraction | ||
|
||
import com.intellij.psi.PsiLiteralExpression | ||
import com.intellij.psi.PsiPolyadicExpression | ||
import com.nhaarman.mockito_kotlin.doReturn | ||
import com.nhaarman.mockito_kotlin.mock | ||
import org.amshove.kluent.shouldContain | ||
import org.amshove.kluent.shouldEqualTo | ||
import org.jetbrains.spek.api.Spek | ||
import org.jetbrains.spek.api.dsl.describe | ||
import org.jetbrains.spek.api.dsl.it | ||
import org.jetbrains.spek.api.dsl.on | ||
|
||
object PsiPolyadicExpressionExtractorSpek : Spek({ | ||
describe("PsiPolyadicExpressionExtractor") { | ||
on("extract with 2 PsiLiteralExpressions") { | ||
it("should return list with sum of literal expressions texts") { | ||
val apiElement = mock<PsiLiteralExpression> { | ||
on { text } doReturn "\"/api\"" | ||
} | ||
val versionElement = mock<PsiLiteralExpression> { | ||
on { text } doReturn "\"/v1\"" | ||
} | ||
val psiPolyadicExpression = mock<PsiPolyadicExpression> { | ||
on { operands } doReturn arrayOf(apiElement, versionElement) | ||
} | ||
val extract = PsiPolyadicExpressionExtractor().extract(psiPolyadicExpression) | ||
extract.size shouldEqualTo 1 | ||
extract shouldContain "/api/v1" | ||
} | ||
} | ||
} | ||
}) |
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