Skip to content

Commit

Permalink
support to show that an issue cannot be reproduced
Browse files Browse the repository at this point in the history
  • Loading branch information
rpau committed Mar 14, 2017
1 parent c6adf6a commit 8781ce6
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/test/java/org/walkmod/pmd/visitors/PMDVisitorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,17 @@ public void testRulesPriority_issue10() throws Exception{
Assert.assertTrue(true);

}

@Test
public void testRulesPriority_issue11() throws Exception{
String code = FileUtils.readFileToString(new File("src/test/resources/examples/IncorrectUnusedVar.txt"));
CompilationUnit cu = compile(code);
PMDVisitor visitor = new PMDVisitor();

VisitorContext ctx = new VisitorContext();
visitor.visit(cu, ctx);
System.out.println(cu);
Assert.assertTrue(true);

}
}
18 changes: 18 additions & 0 deletions src/test/resources/examples/IncorrectUnusedVar.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import java.util.Calendar;

import javax.swing.JTextField;

public class RemoveOfUsedVar1 {

private JTextField jYear;
private JTextField jMonth;
private JTextField jDay;

public void setToday() {
Calendar today = Calendar.getInstance();
jYear.setText(String.valueOf(today.get(Calendar.YEAR)));
jMonth.setText(String.valueOf(today.get(Calendar.MONTH) + 1));
jDay.setText(String.valueOf(today.get(Calendar.DATE)));
}

}

0 comments on commit 8781ce6

Please sign in to comment.