Skip to content

Commit

Permalink
if project archived, set allowedActions to empty array
Browse files Browse the repository at this point in the history
  • Loading branch information
krwong committed Sep 24, 2024
1 parent c5268ce commit cb2bf2a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ public class ArchiveProjectsService {
* Archive a list of projects
*/
public void archiveProjects(Path currentDirectory, List<String> projectNames) throws IOException {
if (projectNames == null || projectNames.isEmpty()) {
throw new InvalidProjectStateException("Project names cannot be empty");
}

Path archiveDirectory = currentDirectory.resolve(ARCHIVED);
for (String projectName : projectNames) {
Path projectDirectory = currentDirectory.resolve(projectName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,17 @@ public void archiveInvalidProjectTest() throws Exception {
}
}

@Test
public void archiveEmptyProjectTest() throws Exception {
try {
List<String> testProjects = new ArrayList<>();;
service.archiveProjects(tmpFolder, testProjects);
fail();
} catch (Exception e) {
assertTrue(e.getMessage().contains("Project names cannot be empty"));
}
}

@Test
public void archiveMultipleProjectsTest() throws Exception {
project = MigrationProjectFactory.createMigrationProject(
Expand Down

0 comments on commit cb2bf2a

Please sign in to comment.