Skip to content

Commit

Permalink
test: upgrade test suite to use JUnit 5 (#326)
Browse files Browse the repository at this point in the history
  • Loading branch information
algomaster99 authored Sep 30, 2024
1 parent c9dcc7a commit 1fdf75e
Show file tree
Hide file tree
Showing 12 changed files with 237 additions and 234 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ target
# Spoon
spooned
.settings
spoon.classpath.tmp
21 changes: 16 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
<!-- Dependencies -->
<cli.version>1.9.0</cli.version>

<!-- Test dependencies -->
<junit.version>4.13.2</junit.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -82,11 +80,24 @@
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.11.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.11.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<version>3.0</version>
<scope>test</scope>
</dependency>

</dependencies>

<build>
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/gumtree/spoon/AstComparator.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public Diff compare(File f1, File f2) throws Exception {
return compare(ctPackage1, ctPackage2);
}
}

/**
* compares two AST nodes from two files according with a given configuration
*/
Expand Down Expand Up @@ -101,8 +101,8 @@ public Diff compare(String left, String right, DiffConfiguration configuration)
return compare(getCtPackage(left, getFilename(left)), getCtPackage(right, getFilename(right)),configuration);
}



/**
* compares two snippets that come from the files given as argument
*/
Expand All @@ -118,15 +118,15 @@ public Diff compare(CtElement left, CtElement right) {
return new DiffImpl(scanner.getTreeContext(), scanner.getTree(left), scanner.getTree(right));
}


/**
* compares two AST nodes according with a given configuration
*/
public Diff compare(CtElement left, CtElement right, DiffConfiguration configuration) {
final SpoonGumTreeBuilder scanner = new SpoonGumTreeBuilder();
return new DiffImpl(scanner.getTreeContext(), scanner.getTree(left), scanner.getTree(right),configuration);
}



public CtType getCtType(File file) throws Exception {
Expand Down
Loading

0 comments on commit 1fdf75e

Please sign in to comment.