Skip to content

Commit

Permalink
Update Java action in deploy.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
cesarsotovalero committed Jan 3, 2023
1 parent d66aead commit 0b95116
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 11 additions & 15 deletions src/test/java/se/kth/deptrim/core/TypesExtractorTest.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand All @@ -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<Dependency> 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");
Expand All @@ -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();
Expand Down

0 comments on commit 0b95116

Please sign in to comment.