-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Have
RefasterTemplateCollection
verify template test class names
- Loading branch information
1 parent
b30562b
commit 32a4716
Showing
7 changed files
with
77 additions
and
3 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
21 changes: 21 additions & 0 deletions
21
...upport/src/test/java/tech/picnic/errorprone/refaster/test/MisnamedTestClassTemplates.java
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,21 @@ | ||
package tech.picnic.errorprone.refaster.test; | ||
|
||
import com.google.errorprone.refaster.annotation.AfterTemplate; | ||
import com.google.errorprone.refaster.annotation.BeforeTemplate; | ||
|
||
/** Refaster template collection to validate reporting of a misnamed test class. */ | ||
final class MisnamedTestClassTemplates { | ||
private MisnamedTestClassTemplates() {} | ||
|
||
static final class StringIsEmpty { | ||
@BeforeTemplate | ||
boolean before(String string) { | ||
return string.equals(""); | ||
} | ||
|
||
@AfterTemplate | ||
boolean after(String string) { | ||
return string.isEmpty(); | ||
} | ||
} | ||
} |
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
11 changes: 11 additions & 0 deletions
11
...t/resources/tech/picnic/errorprone/refaster/test/MisnamedTestClassTemplatesTestInput.java
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,11 @@ | ||
package tech.picnic.errorprone.refaster.test; | ||
|
||
/** Code to test the Refaster templates from {@link MisnamedTestClassTemplates}. */ | ||
final class IncorrectNameTemplatesTest implements RefasterTemplateTestCase { | ||
boolean testStringIsEmpty() { | ||
return "foo".equals(""); | ||
} | ||
} | ||
|
||
// This is a comment to appease CheckStyle. | ||
; |
13 changes: 13 additions & 0 deletions
13
.../resources/tech/picnic/errorprone/refaster/test/MisnamedTestClassTemplatesTestOutput.java
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,13 @@ | ||
package tech.picnic.errorprone.refaster.test; | ||
|
||
/** Code to test the Refaster templates from {@link MisnamedTestClassTemplates}. */ | ||
/* ERROR: Class should be named `MisnamedTestClassTemplatesTest`. */ | ||
final class IncorrectNameTemplatesTest implements RefasterTemplateTestCase { | ||
boolean testStringIsEmpty() { | ||
return "foo".isEmpty(); | ||
} | ||
} | ||
|
||
// This is a comment to appease CheckStyle. | ||
/* ERROR: Unexpected declaration. */ | ||
; |