Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#1031.Test case, String[].length, for UseStringIsEmptyRule
- Loading branch information
1 parent
a57c230
commit 9197c99
Showing
2 changed files
with
45 additions
and
0 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
27 changes: 27 additions & 0 deletions
27
qulice-pmd/src/test/resources/com/qulice/pmd/ArrayOfStringsLengthGreaterThanZero.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,27 @@ | ||
package foo; | ||
|
||
public final class ArrayOfStringsLengthGreaterThanZero { | ||
|
||
private final String[] strings; | ||
|
||
public ArrayOfStringsLengthGreaterThanZero(final String... args) { | ||
this.strings = args.clone(); | ||
} | ||
|
||
public String[] args() { | ||
return this.strings.clone(); | ||
} | ||
|
||
public boolean arrayFromArgs(final String... args) { | ||
return args.length > 0; | ||
} | ||
|
||
public boolean arrayFromField() { | ||
return this.strings.length > 0; | ||
} | ||
|
||
public boolean arrayFromMethod() { | ||
return this.args().length > 0; | ||
} | ||
|
||
} |