Skip to content

Commit

Permalink
Springdoc / remove old contains dependency method
Browse files Browse the repository at this point in the history
  • Loading branch information
Bolo89 committed May 31, 2022
1 parent 9e2549d commit d8a1682
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import static tech.jhipster.lite.generator.project.domain.BuildToolType.MAVEN;

import java.io.IOException;
import java.util.List;
import java.util.Optional;
import tech.jhipster.lite.error.domain.GeneratorException;
Expand Down Expand Up @@ -152,12 +151,4 @@ public Optional<String> getName(Project project) {
}
throw new GeneratorException(EXCEPTION_NO_BUILD_TOOL);
}

@Override
public boolean containsDependency(Project project, String dependencyName) throws IOException {
if (project.isMavenProject()) {
return mavenService.containsDependency(project, dependencyName);
}
throw new GeneratorException(EXCEPTION_NO_BUILD_TOOL);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package tech.jhipster.lite.generator.buildtool.generic.domain;

import java.io.IOException;
import java.util.List;
import java.util.Optional;
import tech.jhipster.lite.generator.project.domain.BuildToolType;
Expand All @@ -25,6 +24,4 @@ public interface BuildToolService {
Optional<String> getGroup(Project project);

Optional<String> getName(Project project);

boolean containsDependency(Project project, String dependencyName) throws IOException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -183,18 +183,6 @@ void shouldGetName() {

verify(mavenService).getName(project.getFolder());
}

@Test
void shouldReturnTrueWhenDependencyFound() throws IOException {
Project project = tmpProjectWithPomXml();
when(mavenService.containsDependency(any(), anyString())).thenReturn(true);

String dependencyName = "spring-boot";
boolean dependencyFound = buildToolDomainService.containsDependency(project, dependencyName);

assertThat(dependencyFound).isTrue();
verify(mavenService).containsDependency(project, dependencyName);
}
}

@Nested
Expand Down Expand Up @@ -358,21 +346,6 @@ void shouldNotGetName() {

assertThatThrownBy(() -> buildToolDomainService.getName(project)).isExactlyInstanceOf(GeneratorException.class);
}

@Test
void shouldNotDeleteDependency() {
Project project = tmpProject();
Dependency dependency = Dependency.builder().groupId("org.springframework.boot").artifactId("spring-boot-starter").build();

assertThatThrownBy(() -> buildToolDomainService.deleteDependency(project, dependency)).isExactlyInstanceOf(GeneratorException.class);
}

@Test
void shouldNotReturnWhenCheckDependency() {
Project project = Project.builder().folder("foo").build();

assertThatThrownBy(() -> buildToolDomainService.containsDependency(project, "spring-boot")).isInstanceOf(GeneratorException.class);
}
}

private Parent getParent() {
Expand Down

0 comments on commit d8a1682

Please sign in to comment.