Skip to content

Commit

Permalink
modify test to check every property
Browse files Browse the repository at this point in the history
  • Loading branch information
JuditKnoll committed Oct 25, 2023
1 parent 157d898 commit cf27631
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,21 @@

class UnnecessaryEnvUsageTest extends AbstractIntegrationTest {
@Test
void testingVariuosEnvUsages() {
void testingEnvUsages() {
performAnalysis("UnnecessaryEnvUsage.class");
assertBug(2);
assertBug(12);
assertBug("replaceableEnvUsage", 3);
assertBug("replaceableEnvUsage", 4);
assertBug("replaceableEnvUsage", 5);
assertBug("replaceableEnvUsage", 6);
assertBug("replaceableEnvUsage", 7);
assertBug("replaceableEnvUsage", 8);
assertBug("replaceableEnvUsage", 9);
assertBug("replaceableEnvUsage", 10);
assertBug("replaceableEnvUsage", 11);
assertBug("replaceableEnvUsage", 12);
assertBug("replaceableEnvUsage", 13);
assertBug("replaceableEnvUsage", 14);
}

private void assertBug(int num) {
Expand Down
10 changes: 10 additions & 0 deletions spotbugsTestCases/src/java/UnnecessaryEnvUsage.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
public class UnnecessaryEnvUsage {
public void replaceableEnvUsage() {
System.getenv("JAVA_HOME");
System.getenv("JAVA_VERSION");
System.getenv("TEMP");
System.getenv("TMP");
System.getenv("PROCESSOR_ARCHITECTURE");
System.getenv("OS");
System.getenv("USER");
System.getenv("USERNAME");
System.getenv("HOME");
System.getenv("HOMEPATH");
System.getenv("CD");
System.getenv("PWD");
}

public void necessaryEnvUsage() {
Expand Down

0 comments on commit cf27631

Please sign in to comment.