You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .claude/guidelines/TEST_CASE_GUIDELINE.md
+19-2Lines changed: 19 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ Follow the rules below when implementing test code.
4
4
## Code Inspection Functionality
5
5
Implement tests for code inspection functionality using the following steps:
6
6
7
-
### **Implementation of Test Case Classes**
7
+
##Implementation of Test Case Classes
8
8
- Implement test case classes in `@src/test/kotlin/org/domaframework/doma/intellij/inspection`.
9
9
- Implement test cases for each subclass of **AbstractBaseJavaLocalInspectionTool**.
10
10
- Name the test case class as `<InspectionToolName>InspectionTest`.
@@ -17,14 +17,31 @@ Implement tests for code inspection functionality using the following steps:
17
17
Create the target Dao class or SQL file for inspection.
18
18
Wrap the elements to be error-highlighted with the **<error>** tag and specify the error message to be displayed using the **descr** option.
19
19
20
-
#### Test Data for Dao Classes
20
+
**Test Data for Dao Classes**
21
21
- Implement test data Dao classes in **Java**.
22
22
- Annotate test data Dao classes with **@Dao**.
23
23
- Place them under the appropriate subpackage in `@src/test/testData/src/main/java/doma/example/dao/inspection`.
24
24
- Implement any other necessary classes as needed.
25
25
26
+
**Entity Test Data**
27
+
When creating test cases, prepare and verify the following Entity classes to test parent-child relationships:
28
+
- Parent class annotated with @Entity
29
+
- Subclass without @Entity annotation
30
+
- Subclass annotated with @Entity
31
+
32
+
Using the above, create the following test cases for features that use `PsiClass`:
33
+
- Test cases using fields/methods defined in parent classes
34
+
- Test cases using fields/methods defined in subclasses
35
+
36
+
**Examples**
37
+
- Test that bind variable definition inspection doesn't highlight errors when using fields defined in parent classes
38
+
- Test that include/exclude option checking in DAO method annotations doesn't highlight errors when using fields defined in parent classes
39
+
- Test that code completion shows fields/methods defined in parent classes as completion candidates
40
+
26
41
#### Test Data for SQL Files
27
42
- Create and place SQL files in a directory named after the corresponding Dao class under `@src/test/testData/src/main/resources/META-INF/doma/example/dao`.
43
+
- When creating test cases for bind variables, prepare test data that checks instance field methods, static field methods, field methods of elements defined in loop directives, custom functions, and built-in functions.
44
+
For cases combining multiple variables, ensure comprehensive coverage of all variable combination patterns.
28
45
29
46
### Reference
30
47
For actual implementation examples using Doma, refer to the [Doma GitHub repository](https://github.com/domaframework/doma/tree/master/integration-test-java/src/main/java/org/seasar/doma/it/dao).
Copy file name to clipboardExpand all lines: CLAUDE.md
+17Lines changed: 17 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -107,6 +107,19 @@ Feature Package
107
107
└── AnAction subclass
108
108
```
109
109
110
+
### Common
111
+
112
+
**Accessing `PsiClass` Members**
113
+
When retrieving fields and methods from `PsiClass`, use `allFields` and `allMethods` instead of `fields` and `methods`.
114
+
This is necessary to include members defined in parent classes.
115
+
116
+
Alternatively, you can use [PsiParentClass](src/main/kotlin/org/domaframework/doma/intellij/common/psi/PsiParentClass.kt)
117
+
to achieve equivalent functionality with `findField()` and `findMethod()`.
118
+
119
+
**Separating Complex Logic**
120
+
Each feature requires implementing corresponding classes following the IntelliJ platform conventions.
121
+
Complex logic should not be implemented directly in these corresponding classes but delegated to separate classes (Processors or Handlers).
122
+
110
123
### Actions
111
124
Action functionality for navigating between DAO files and SQL files
112
125
@@ -171,6 +184,10 @@ Code inspection functionality for DAO methods and DOMA directives in SQL
171
184
-[ValidationResult](src/main/kotlin/org/domaframework/doma/intellij/common/validation/result): Classes that provide error messages and highlights for code inspection results
172
185
-**Class Naming Rules**: Use `ValidationResult` as a suffix. Name classes according to the message resources to be displayed
173
186
187
+
**Coding Rule**
188
+
For code inspection features, always implement `InspectionTool` and `Visitor` as separate classes.
189
+
When the logic within `Visitor` becomes complex, implement separate Processor classes for main processing or Handler classes for error highlighting.
190
+
174
191
### Completion
175
192
Code completion functionality for DOMA directive syntax in SQL
0 commit comments