Replace public method with public constant

This commit is contained in:
René Pfeuffer
2018-11-22 16:41:06 +01:00
parent 00e3cbec57
commit d329ca56f8
2 changed files with 4 additions and 8 deletions

View File

@@ -21,7 +21,7 @@ import java.io.IOException;
*/
public class InitialRepositoryLocationResolver {
private static final String DEFAULT_REPOSITORY_PATH = "repositories";
public static final String DEFAULT_REPOSITORY_PATH = "repositories";
public static final String REPOSITORIES_NATIVE_DIRECTORY = "data";
private SCMContextProvider context;
private FileSystem fileSystem;
@@ -49,10 +49,6 @@ public class InitialRepositoryLocationResolver {
}
public String getRelativeRepositoryPath(Repository repository) {
return getDefaultRepositoryPath() + File.separator + repository.getId();
}
public String getDefaultRepositoryPath() {
return DEFAULT_REPOSITORY_PATH;
return DEFAULT_REPOSITORY_PATH + File.separator + repository.getId();
}
}

View File

@@ -55,7 +55,7 @@ public class XmlRepositoryDAOTest {
verify(db).add(argThat(repositoryPath -> {
assertThat(repositoryPath.getId()).isEqualTo("id");
assertThat(repositoryPath.getPath()).isEqualTo(initialRepositoryLocationResolver.getDefaultRepositoryPath() + "/id");
assertThat(repositoryPath.getPath()).isEqualTo(InitialRepositoryLocationResolver.DEFAULT_REPOSITORY_PATH + "/id");
return true;
}));
verify(store).set(db);
@@ -112,6 +112,6 @@ public class XmlRepositoryDAOTest {
Repository newRepository = new Repository("id", "new", null, null);
Path path = dao.getPath(newRepository);
assertThat(path.toString()).isEqualTo(context.getBaseDirectory().getPath() + "/" + initialRepositoryLocationResolver.getDefaultRepositoryPath() + "/id");
assertThat(path.toString()).isEqualTo(context.getBaseDirectory().getPath() + "/" + InitialRepositoryLocationResolver.DEFAULT_REPOSITORY_PATH + "/id");
}
}