mirror of
https://gitee.com/dcren/initializr.git
synced 2025-09-18 17:48:14 +08:00
Add method for asserting that a pom does not have a dependency
Closes gh-842
This commit is contained in:
@@ -266,6 +266,23 @@ public class PomAssert {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert that {@code pom.xml} does not define a dependency with the specified
|
||||
* {@code groupId} and {@code artifactId}.
|
||||
* @param groupId the dependency's groupId
|
||||
* @param artifactId the dependency's artifactId
|
||||
* @return this
|
||||
*/
|
||||
public PomAssert doesNotHaveDependency(String groupId, String artifactId) {
|
||||
assertThat(this.pom).nodesAtPath("/project/dependencies/dependency")
|
||||
.noneMatch((candidate) -> {
|
||||
Dependency actual = toDependency(candidate);
|
||||
return groupId.equals(actual.getGroupId())
|
||||
&& artifactId.equals(actual.getArtifactId());
|
||||
});
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert {@code pom.xml} defines the specified number of boms.
|
||||
* @param count the number of boms
|
||||
|
Reference in New Issue
Block a user