Skip to content

Commit

Permalink
Merge pull request #1461 from qmonmert/fix/1452-v2
Browse files Browse the repository at this point in the history
Download: only JHipster Lite project
  • Loading branch information
pascalgrimaud authored Apr 24, 2022
2 parents 926d1d5 + 09b600d commit 3584edc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ public void gitInit(Project project) {

@Override
public byte[] download(Project project) {
return projectRepository.download(project);
if (projectRepository.isJHipsterLiteProject(project.getFolder())) {
return projectRepository.download(project);
}
throw new GeneratorException("This project is not a JHipster Lite project");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,17 @@ void shouldAddPrettier() {
void shouldDownload() {
Project project = tmpProjectWithPomXml();

when(projectRepository.isJHipsterLiteProject(anyString())).thenReturn(true);

assertThatCode(() -> initDomainService.download(project)).doesNotThrowAnyException();
}

@Test
void shouldNotDownload() {
Project project = tmpProjectWithPomXml();

when(projectRepository.isJHipsterLiteProject(anyString())).thenReturn(false);

assertThatThrownBy(() -> initDomainService.download(project)).isExactlyInstanceOf(GeneratorException.class);
}
}

0 comments on commit 3584edc

Please sign in to comment.