-
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.
- Loading branch information
Showing
8 changed files
with
101 additions
and
39 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
32 changes: 32 additions & 0 deletions
32
...support/src/test/java/tech/picnic/errorprone/refaster/test/PartialTestMatchTemplates.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,32 @@ | ||
package tech.picnic.errorprone.refaster.test; | ||
|
||
import com.google.errorprone.refaster.annotation.AfterTemplate; | ||
import com.google.errorprone.refaster.annotation.BeforeTemplate; | ||
|
||
public class PartialTestMatchTemplates { | ||
private PartialTestMatchTemplates() {} | ||
|
||
static final class StringIsEmpty { | ||
@BeforeTemplate | ||
boolean before(String string) { | ||
return string.equals(""); | ||
} | ||
|
||
@AfterTemplate | ||
boolean after(String string) { | ||
return string.isEmpty(); | ||
} | ||
} | ||
|
||
static final class StringEquals { | ||
@BeforeTemplate | ||
boolean before(String string1, String string2) { | ||
return string1 == string2; | ||
} | ||
|
||
@AfterTemplate | ||
boolean after(String string1, String string2) { | ||
return string1.equals(string2); | ||
} | ||
} | ||
} |
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
...st/resources/tech/picnic/errorprone/refaster/test/PartialTestMatchTemplatesTestInput.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,9 @@ | ||
package tech.picnic.errorprone.refaster.test; | ||
|
||
/** Code to test the Refaster templates from {@link PartialTestMatchTemplates}. */ | ||
final class PartialTestMatchTemplatesTest implements RefasterTemplateTestCase { | ||
boolean testStringIsEmpty() { | ||
boolean b = "foo" == ""; | ||
return "bar".equals(""); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...t/resources/tech/picnic/errorprone/refaster/test/PartialTestMatchTemplatesTestOutput.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 PartialTestMatchTemplates}. */ | ||
final class PartialTestMatchTemplatesTest implements RefasterTemplateTestCase { | ||
/* | ||
* The following matches unexpectedly occurred in method `testStringIsEmpty`: | ||
* - Template `StringEquals` matches on line 6, while it should match in a method named `testStringEquals`. | ||
*/ | ||
boolean testStringIsEmpty() { | ||
boolean b = "foo".equals(""); | ||
return "bar".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