-
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.
Merge pull request #105 from ABHAY0O7/class-analyzer-test
Class analyzer test
- Loading branch information
Showing
7 changed files
with
43 additions
and
7 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
35 changes: 35 additions & 0 deletions
35
depclean-core/src/test/java/se/kth/depclean/core/analysis/DefaultClassAnalyzerTest.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,35 @@ | ||
package se.kth.depclean.core.analysis; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.net.URL; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
|
||
class DefaultClassAnalyzerTest { | ||
|
||
// This jar file only contains "ExampleClass.class" | ||
File jarFile = new File("src/test/resources/analysisResources/ExampleClass.jar"); | ||
File directoryFile = new File("src/test/resources/asmAndGraphResources"); | ||
|
||
@Test | ||
@DisplayName("Test that the DCA is accepting a jar and returning its classes successfully.") | ||
void DCA_jar_test() throws IOException { | ||
URL url = jarFile.toURI().toURL(); | ||
Assertions.assertFalse(analyze(url)); | ||
} | ||
|
||
@Test | ||
@DisplayName("Test that the DCA is accepting a directory and returning its classes successfully.") | ||
void DCA_directory_test() throws IOException { | ||
URL url = directoryFile.toURI().toURL(); | ||
Assertions.assertFalse(analyze(url)); | ||
} | ||
|
||
// Utility method to get the classes. | ||
boolean analyze(URL url) throws IOException { | ||
ClassAnalyzer classAnalyzer = new DefaultClassAnalyzer(); | ||
return classAnalyzer.analyze(url).isEmpty(); | ||
} | ||
} |
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
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
Binary file added
BIN
+1009 Bytes
depclean-core/src/test/resources/analysisResources/ExampleClass.jar
Binary file not shown.
File renamed without changes.
File renamed without changes.