diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index a0872c5..a59e895 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -14,7 +14,7 @@ jobs: uses: actions/checkout@v3 - name: Install Java and Maven - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: distribution: 'adopt-hotspot' java-version: 17 diff --git a/src/test/java/se/kth/deptrim/core/TypesExtractorTest.java b/src/test/java/se/kth/deptrim/core/TypesExtractorTest.java index 66efdb8..6d9cf94 100644 --- a/src/test/java/se/kth/deptrim/core/TypesExtractorTest.java +++ b/src/test/java/se/kth/deptrim/core/TypesExtractorTest.java @@ -1,6 +1,8 @@ package se.kth.deptrim.core; import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; import java.io.File; import java.io.IOException; @@ -10,7 +12,6 @@ import org.apache.commons.io.FileUtils; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; -import org.mockito.Mockito; import se.kth.depclean.core.analysis.graph.DependencyGraph; import se.kth.depclean.core.model.Dependency; import se.kth.depclean.core.wrapper.DependencyManagerWrapper; @@ -24,10 +25,10 @@ class TypesExtractorTest { @Test void testExtractAllTypes() throws Exception { // Set up mock DependencyManagerWrapper and Dependency - DependencyManagerWrapper dependencyManager = Mockito.mock(DependencyManagerWrapper.class); - DependencyGraph dependencyGraph = Mockito.mock(DependencyGraph.class); - Dependency dependency1 = Mockito.mock(Dependency.class); - Dependency dependency2 = Mockito.mock(Dependency.class); + DependencyManagerWrapper dependencyManager = mock(DependencyManagerWrapper.class); + DependencyGraph dependencyGraph = mock(DependencyGraph.class); + Dependency dependency1 = mock(Dependency.class); + Dependency dependency2 = mock(Dependency.class); HashSet dependencies = new HashSet<>(Arrays.asList(dependency1, dependency2)); File libsDirectory = new File(fakeProjectRoot.getAbsolutePath() + File.separator + "libs"); File targetDirectory = new File(fakeProjectRoot.getAbsolutePath() + File.separator + "target"); @@ -43,16 +44,11 @@ void testExtractAllTypes() throws Exception { FileUtils.copyFileToDirectory(jarFile2, libsDirectory); jarFile1 = new File(dependencyDirectory + File.separator + "auto-value-annotations-1.8.1.jar"); jarFile2 = new File(libsDirectory + File.separator + "checker-qual-3.8.0.jar"); - Mockito.when(dependency1.getFile()) - .thenReturn(jarFile1); - Mockito.when(dependency2.getFile()) - .thenReturn(jarFile2); - Mockito.when(dependencyManager.dependencyGraph()) - .thenReturn(dependencyGraph); - Mockito.when(dependencyGraph.allDependencies()) - .thenReturn(dependencies); - Mockito.when(dependencyManager.getBuildDirectory()) - .thenReturn(Paths.get("src/test/resources/target/")); + when(dependency1.getFile()).thenReturn(jarFile1); + when(dependency2.getFile()).thenReturn(jarFile2); + when(dependencyManager.dependencyGraph()).thenReturn(dependencyGraph); + when(dependencyGraph.allDependencies()).thenReturn(dependencies); + when(dependencyManager.getBuildDirectory()).thenReturn(Paths.get("src/test/resources/target/")); // Create TypesExtractor and extract types TypesExtractor extractor = new TypesExtractor(dependencyManager); extractor.extractAllTypes();