Skip to content

Commit 7f4b99e

Browse files
committed
테스트 라이브데이터 추가
1 parent 8bd8332 commit 7f4b99e

File tree

3 files changed

+52
-0
lines changed

3 files changed

+52
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package kr.co.finda.androidtemplate.feature
2+
3+
import com.intellij.codeInsight.template.TemplateContextType
4+
import com.intellij.psi.PsiFile
5+
6+
class FindaTestTemplateContextType : TemplateContextType("FINDA_TEST", "FindaTest") {
7+
8+
override fun isInContext(file: PsiFile, offset: Int): Boolean {
9+
return file.name.endsWith("Test.kt")
10+
}
11+
}

src/main/resources/META-INF/plugin.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,9 @@
1414
<add-to-group group-id="NewGroup" anchor="first"/>
1515
</action>
1616
</actions>
17+
18+
<extensions defaultExtensionNs="com.intellij">
19+
<defaultLiveTemplates file="/liveTemplates/FindaTest.xml" />
20+
<liveTemplateContext implementation="kr.co.finda.androidtemplate.feature.FindaTestTemplateContextType" />
21+
</extensions>
1722
</idea-plugin>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<templateSet group="FindaTest">
2+
<template name="tcasenested" value="@Test&#10;@DisplayName(&quot;$DISPLAY_NAME$&quot;)&#10;fun $TEST_NAME$_$CONDITION$_$EXPECT$() {&#10; // GIVEN&#10; $CONTENT$&#10; viewModel = buildViewModel()&#10; &#10; // WHEN&#10; &#10; // THEN&#10;}" description="Create test case in @Nested" toReformat="false" toShortenFQNames="true">
3+
<variable name="DISPLAY_NAME" expression="" defaultValue="" alwaysStopAt="true" />
4+
<variable name="TEST_NAME" expression="" defaultValue="" alwaysStopAt="true" />
5+
<variable name="CONDITION" expression="" defaultValue="" alwaysStopAt="true" />
6+
<variable name="EXPECT" expression="" defaultValue="" alwaysStopAt="true" />
7+
<variable name="CONTENT" expression="" defaultValue="" alwaysStopAt="true" />
8+
<context>
9+
<option name="KOTLIN_CLASS" value="true" />
10+
</context>
11+
</template>
12+
<template name="tcase" value="@Test&#10;@DisplayName(&quot;$DISPLAY_NAME$&quot;)&#10;fun $TEST_NAME$_$EXPECT$() {&#10; // GIVEN&#10; $CONTENT$&#10; viewModel = buildViewModel()&#10; &#10; // WHEN&#10; &#10; // THEN&#10;}" description="Create test case" toReformat="false" toShortenFQNames="true">
13+
<variable name="DISPLAY_NAME" expression="" defaultValue="" alwaysStopAt="true" />
14+
<variable name="TEST_NAME" expression="" defaultValue="" alwaysStopAt="true" />
15+
<variable name="EXPECT" expression="" defaultValue="" alwaysStopAt="true" />
16+
<variable name="CONTENT" expression="" defaultValue="" alwaysStopAt="true" />
17+
<context>
18+
<option name="KOTLIN_CLASS" value="true" />
19+
</context>
20+
</template>
21+
<template name="tnest" value="@Nested&#10;@DisplayName(&quot;$DISPLAY_NAME$&quot;)&#10;inner class $CLASS_NAME$ {&#10;&#10; $CONTENT$&#10;}" description="Create @Nested class" toReformat="false" toShortenFQNames="true">
22+
<variable name="DISPLAY_NAME" expression="" defaultValue="" alwaysStopAt="true" />
23+
<variable name="CLASS_NAME" expression="" defaultValue="" alwaysStopAt="true" />
24+
<variable name="CONTENT" expression="" defaultValue="" alwaysStopAt="true" />
25+
<context>
26+
<option name="KOTLIN_CLASS" value="true" />
27+
</context>
28+
</template>
29+
<template name="tmock" value="@Mock&#10;private lateinit var $NAME$: $TYPE$&#10;" description="Create @Mock property" toReformat="false" toShortenFQNames="true">
30+
<variable name="NAME" expression="capitalize(String)" defaultValue="" alwaysStopAt="true" />
31+
<variable name="TYPE" expression="" defaultValue="" alwaysStopAt="true" />
32+
<context>
33+
<option name="KOTLIN_CLASS" value="true" />
34+
</context>
35+
</template>
36+
</templateSet>

0 commit comments

Comments
 (0)