Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,13 @@

import java.io.File;

import static java.lang.String.format;
import static java.util.Arrays.asList;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.when;

public class FileSystemLocationTest {
private static final String FILE_SEPARATOR = File.separator;

@Mock
private JenkinsDeploymentListener listener;
Expand All @@ -63,7 +61,7 @@ public void setUp() {
@Test
public void shouldReturnPathWithoutChangesIfLocal() {
FileSystemLocation fileSystemLocation = new FileSystemLocation("test.dar","./build/resources/test");
assertThat(fileSystemLocation.getDarFileLocation(localFilePath, listener, new EnvVars()), is(format("build%sresources%stest%stest.dar", FILE_SEPARATOR, FILE_SEPARATOR, FILE_SEPARATOR)));
assertThat(fileSystemLocation.getDarFileLocation(localFilePath, listener, new EnvVars()), is("build/resources/test/test.dar"));
}

@Test
Expand All @@ -84,7 +82,7 @@ public void shouldResolveEnvVarInPath() throws Exception {
EnvVars envVars = new EnvVars();
envVars.put("NAME","test");
FileSystemLocation fileSystemLocation = new FileSystemLocation("$NAME.dar","./build/resources/test");
assertThat(fileSystemLocation.getDarFileLocation(localFilePath, listener, envVars), is(format("build%sresources%stest%stest.dar", FILE_SEPARATOR, FILE_SEPARATOR, FILE_SEPARATOR)));
assertThat(fileSystemLocation.getDarFileLocation(localFilePath, listener, envVars), is("build/resources/test/test.dar"));

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,11 @@
import hudson.FilePath;
import hudson.remoting.VirtualChannel;

import static java.lang.String.format;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertThat;

public class GeneratedLocationTest {
private static final String FILE_SEPARATOR = File.separator;

@Mock
private JenkinsDeploymentListener listener;
Expand All @@ -63,7 +61,7 @@ public void setUp() {
@Test
public void shouldReturnPathWithoutChangesIfLocal() {
generatedLocation.setGeneratedLocation("/tmp/test-local/asd.dar");
assertThat(generatedLocation.getDarFileLocation(localFilePath, listener, new EnvVars()), is(format("%stmp%stest-local%sasd.dar", FILE_SEPARATOR, FILE_SEPARATOR, FILE_SEPARATOR)));
assertThat(generatedLocation.getDarFileLocation(localFilePath, listener, new EnvVars()), is("/tmp/test-local/asd.dar"));
}

@Test
Expand Down