Skip to content

Commit

Permalink
corrected the condition to identify a setUp method
Browse files Browse the repository at this point in the history
  • Loading branch information
shehan committed Jan 29, 2018
1 parent c2e53b6 commit 6f70d01
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/testsmell/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public static boolean isValidSetupMethod(MethodDeclaration n) {
boolean valid = false;

if (!n.getAnnotationByName("Ignore").isPresent()) {
//only analyze methods that either have a @test annotation (Junit 4) or the method name starts with 'test'
if (n.getAnnotationByName("Before").isPresent() || n.getNameAsString().toLowerCase().equals("setUp")) {
//only analyze methods that either have a @Before annotation (Junit 4) or the method name is 'setUp'
if (n.getAnnotationByName("Before").isPresent() || n.getNameAsString().equals("setUp")) {
//must be a public method
if (n.getModifiers().contains(Modifier.PUBLIC)) {
valid = true;
Expand Down

0 comments on commit 6f70d01

Please sign in to comment.