-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Configure Depclean to run integration tests (#54)
- Loading branch information
1 parent
22141be
commit ca4075d
Showing
23 changed files
with
665 additions
and
158 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ _site | |
Gemfile.lock | ||
*.gem | ||
*.idea | ||
*.iml | ||
|
||
target/ | ||
|
||
|
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 |
---|---|---|
|
@@ -113,4 +113,5 @@ | |
<scope>compile</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
23 changes: 12 additions & 11 deletions
23
depclean-core/src/test/java/se/kth/depclean/core/analysis/ClassFileVisitorUtilsTest.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 |
---|---|---|
@@ -1,22 +1,23 @@ | ||
package se.kth.depclean.core.analysis; | ||
|
||
import org.junit.After; | ||
import org.junit.Assert; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
public class ClassFileVisitorUtilsTest { | ||
import org.junit.jupiter.api.AfterEach; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
@Before | ||
public void setUp() throws Exception { | ||
class ClassFileVisitorUtilsTest { | ||
|
||
@BeforeEach | ||
void setUp() { | ||
} | ||
|
||
@After | ||
public void tearDown() throws Exception { | ||
@AfterEach | ||
void tearDown() { | ||
} | ||
|
||
@Test | ||
public void accept() { | ||
Assert.assertTrue(true); | ||
void dummy() { | ||
assertTrue(true); | ||
} | ||
} |
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
29 changes: 29 additions & 0 deletions
29
depclean-maven-plugin/src/test/java/se/kth/depclean/DepCleanMojoIT.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,29 @@ | ||
package se.kth.depclean; | ||
|
||
import static com.soebes.itf.extension.assertj.MavenITAssertions.assertThat; | ||
|
||
import com.soebes.itf.jupiter.extension.MavenGoal; | ||
import com.soebes.itf.jupiter.extension.MavenJupiterExtension; | ||
import com.soebes.itf.jupiter.extension.MavenTest; | ||
import com.soebes.itf.jupiter.maven.MavenExecutionResult; | ||
import org.junit.jupiter.api.DisplayName; | ||
|
||
/** | ||
* This class executes integration tests against the DepCleanMojo. The projects used for testing are in | ||
* src/test/resources-its/se/kth/depclean/DepCleanMojoIT. The results of the DepClean executions for each project are in | ||
* target/maven-it/se/kth/depclean/DepCleanMojoIT. | ||
* <p> | ||
* @see <a https://khmarbaise.github.io/maven-it-extension/itf-documentation/background/background.html#_assertions_in_maven_tests</a> | ||
*/ | ||
@MavenJupiterExtension | ||
public class DepCleanMojoIT { | ||
|
||
@MavenTest | ||
@MavenGoal("package") | ||
@DisplayName("Test that DepClean runs in an empty Maven project") | ||
void empty_project(MavenExecutionResult result) { | ||
assertThat(result).isFailure(); // should pass | ||
} | ||
|
||
} | ||
|
19 changes: 0 additions & 19 deletions
19
depclean-maven-plugin/src/test/java/se/kth/depclean/core/maven/plugin/FileUtilsTest.java
This file was deleted.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
depclean-maven-plugin/src/test/java/se/kth/depclean/util/FileUtilsTest.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,30 @@ | ||
package se.kth.depclean.util; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import org.junit.jupiter.api.AfterEach; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
class FileUtilsTest { | ||
|
||
@BeforeEach | ||
void setUp() { | ||
} | ||
|
||
@AfterEach | ||
void tearDown() { | ||
} | ||
|
||
@Test | ||
void deleteDirectory() throws IOException { | ||
File file = new File("./target/dependency"); | ||
if (file.exists()) { | ||
FileUtils.deleteDirectory(new File("./target/dependency")); | ||
} | ||
assertFalse(file.exists()); | ||
} | ||
|
||
} |
61 changes: 61 additions & 0 deletions
61
...gin/src/test/resources-its/se/kth/depclean/DepCleanMojoIT/all_dependencies_unused/pom.xml
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,61 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>org.foo.bar</groupId> | ||
<artifactId>foobar</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
<name>foobar</name> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | ||
<maven.compiler.source>11</maven.compiler.source> | ||
<maven.compiler.target>11</maven.compiler.target> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-databind</artifactId> | ||
<version>2.12.2</version> | ||
<!--<scope>test</scope>--> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>com.soebes.itf.jupiter.extension</groupId> | ||
<artifactId>itf-failure-plugin</artifactId> | ||
<version>0.9.0</version> | ||
<executions> | ||
<execution> | ||
<id>first_very_simple</id> | ||
<phase>initialize</phase> | ||
<goals> | ||
<goal>failure</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>se.kth.castor</groupId> | ||
<artifactId>depclean-maven-plugin</artifactId> | ||
<version>2.0.1</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>depclean</goal> | ||
</goals> | ||
<!--<configuration>--> | ||
<!-- <failIfUnusedDirect>true</failIfUnusedDirect>--> | ||
<!-- <ignoreScopes>test,provided,import,runtime</ignoreScopes>--> | ||
<!--</configuration>--> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
File renamed without changes.
Oops, something went wrong.