-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ahmadsebak
committed
Jun 21, 2015
1 parent
02978f1
commit a151093
Showing
3 changed files
with
47 additions
and
2 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
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
45 changes: 45 additions & 0 deletions
45
test/com/atsebak/embeddedlinuxjvm/services/ClasspathServiceTest.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,45 @@ | ||
package com.atsebak.embeddedlinuxjvm.services; | ||
|
||
import com.intellij.openapi.project.Project; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
import java.io.File; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.mockito.Mockito.mock; | ||
import static org.mockito.Mockito.when; | ||
|
||
public class ClasspathServiceTest { | ||
private final Project project = mock(Project.class); | ||
private ClasspathService classpathService; | ||
private File jar1 = mock(File.class); | ||
private File jar2 = mock(File.class); | ||
private File output = mock(File.class); | ||
private List<File> hostFiles; | ||
|
||
@Before | ||
public void setUp() throws Exception { | ||
classpathService = new ClasspathService(project); | ||
hostFiles = Arrays.asList(jar1, jar2, output); | ||
when(jar1.getName()).thenReturn("randomjar1.jar"); | ||
when(jar2.getName()).thenReturn("randomjar2.jar"); | ||
when(output.getName()).thenReturn("untitledproject"); | ||
} | ||
|
||
@Test | ||
public void testFirstDeployment() { | ||
List<File> filesToDeploy = classpathService.deltaOfDeployedJars(hostFiles); | ||
assertEquals(filesToDeploy, hostFiles); | ||
} | ||
|
||
@Test | ||
public void testSecondDeployment() { | ||
List<File> filesToDeploy = classpathService.deltaOfDeployedJars(hostFiles); | ||
assertEquals(filesToDeploy, hostFiles); | ||
filesToDeploy = classpathService.deltaOfDeployedJars(hostFiles); | ||
assertEquals(filesToDeploy, Arrays.asList(output)); | ||
} | ||
} |