-
Notifications
You must be signed in to change notification settings - Fork 146
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
13 changed files
with
179 additions
and
99 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
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
63 changes: 0 additions & 63 deletions
63
idea-plugin/src/main/kotlin/com/itangcent/intellij/extend/rx/AutoComputerExtend.kt
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
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
99 changes: 99 additions & 0 deletions
99
...kotlin/com/itangcent/idea/plugin/api/export/core/ComponentMethodDocBuilderListenerTest.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,99 @@ | ||
package com.itangcent.idea.plugin.api.export.core | ||
|
||
import com.google.inject.Inject | ||
import com.itangcent.common.model.MethodDoc | ||
import com.itangcent.intellij.context.ActionContext | ||
import com.itangcent.intellij.extend.guice.singleton | ||
import com.itangcent.intellij.extend.guice.with | ||
import com.itangcent.mock.AdvancedContextTest | ||
import com.itangcent.mock.FakeExportContext | ||
import org.junit.jupiter.api.BeforeEach | ||
import org.junit.jupiter.api.Test | ||
import kotlin.test.assertEquals | ||
|
||
/** | ||
* Test case of [ComponentMethodDocBuilderListener] | ||
*/ | ||
internal class ComponentMethodDocBuilderListenerTest : AdvancedContextTest() { | ||
|
||
@Inject | ||
private lateinit var methodDocBuilderListener: MethodDocBuilderListener | ||
|
||
private lateinit var methodDoc: MethodDoc | ||
|
||
override fun bind(builder: ActionContext.ActionContextBuilder) { | ||
super.bind(builder) | ||
builder.bind(MethodDocBuilderListener::class) { | ||
it.with(ComponentMethodDocBuilderListener::class).singleton() | ||
} | ||
builder.bindInstance( | ||
"AVAILABLE_METHOD_DOC_BUILDER_LISTENER", | ||
arrayOf<Any>(DefaultMethodDocBuilderListener::class) | ||
) | ||
} | ||
|
||
@BeforeEach | ||
fun init() { | ||
methodDoc = MethodDoc() | ||
} | ||
|
||
@Test | ||
fun testSetName() { | ||
methodDocBuilderListener.setName( | ||
FakeExportContext.INSTANCE, | ||
methodDoc, "test" | ||
) | ||
assertEquals("test", methodDoc.name) | ||
} | ||
|
||
@Test | ||
fun testAppendDesc() { | ||
methodDocBuilderListener.appendDesc( | ||
FakeExportContext.INSTANCE, | ||
methodDoc, "abc" | ||
) | ||
assertEquals("abc", methodDoc.desc) | ||
methodDocBuilderListener.appendDesc( | ||
FakeExportContext.INSTANCE, | ||
methodDoc, "def" | ||
) | ||
assertEquals("abcdef", methodDoc.desc) | ||
} | ||
|
||
@Test | ||
fun testAddParam() { | ||
methodDocBuilderListener.addParam( | ||
FakeExportContext.INSTANCE, | ||
methodDoc, "token", "123", "token for auth", true | ||
) | ||
methodDoc.params!![0].let { | ||
assertEquals("token", it.name) | ||
assertEquals("123", it.value) | ||
assertEquals("token for auth", it.desc) | ||
assertEquals(true, it.required) | ||
} | ||
} | ||
|
||
@Test | ||
fun testSetRet() { | ||
methodDocBuilderListener.setRet( | ||
FakeExportContext.INSTANCE, | ||
methodDoc, "ret" | ||
) | ||
assertEquals("ret", methodDoc.ret) | ||
} | ||
|
||
@Test | ||
fun testAppendRetDesc() { | ||
methodDocBuilderListener.appendRetDesc( | ||
FakeExportContext.INSTANCE, | ||
methodDoc, "abc" | ||
) | ||
assertEquals("abc", methodDoc.retDesc) | ||
methodDocBuilderListener.appendRetDesc( | ||
FakeExportContext.INSTANCE, | ||
methodDoc, "def" | ||
) | ||
assertEquals("abc\ndef", methodDoc.retDesc) | ||
} | ||
} |
Oops, something went wrong.