-
Notifications
You must be signed in to change notification settings - Fork 578
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: updated RV_01_TO_INT to include float and long (#1851)
* fix: updated RV_01_TO_INT to include float and long * chore: resolving spotbugs:spotlessJavaCheck * chore: resolving spotbugs:spotlessJavaCheck for Issue1518Test.java * chore: updated CHANGELOG.md
- Loading branch information
Showing
4 changed files
with
55 additions
and
4 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
23 changes: 23 additions & 0 deletions
23
spotbugs-tests/src/test/java/edu/umd/cs/findbugs/detect/Issue1518Test.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,23 @@ | ||
package edu.umd.cs.findbugs.detect; | ||
|
||
import edu.umd.cs.findbugs.AbstractIntegrationTest; | ||
import edu.umd.cs.findbugs.test.matcher.BugInstanceMatcher; | ||
import edu.umd.cs.findbugs.test.matcher.BugInstanceMatcherBuilder; | ||
import org.junit.Test; | ||
|
||
import static edu.umd.cs.findbugs.test.CountMatcher.containsExactly; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
|
||
/** | ||
* @see <a href="https://github.com/spotbugs/spotbugs/issues/1518">GitHub issue #1518</a> | ||
*/ | ||
public class Issue1518Test extends AbstractIntegrationTest { | ||
@Test | ||
public void test() { | ||
performAnalysis("ghIssues/Issue1518.class"); | ||
BugInstanceMatcher bugTypeMatcher = new BugInstanceMatcherBuilder() | ||
.bugType("RV_01_TO_INT") | ||
.build(); | ||
assertThat(getBugCollection(), containsExactly(3, bugTypeMatcher)); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package ghIssues; | ||
|
||
import java.util.Random; | ||
|
||
public class Issue1518 { | ||
private final Random RANDOM = new Random(); | ||
|
||
public void testDouble() { | ||
int testDouble = (int)RANDOM.nextDouble(); | ||
System.out.println(testDouble); | ||
} | ||
|
||
public void testFloat() { | ||
int testFloat = (int)RANDOM.nextFloat(); | ||
System.out.println(testFloat); | ||
} | ||
|
||
public void testLong() { | ||
int testLong = (int)RANDOM.nextLong(); | ||
System.out.println(testLong); | ||
} | ||
} |