Skip to content

Commit

Permalink
Refactored code: moved method containsOnlyExtProperties to AbstractTe…
Browse files Browse the repository at this point in the history
…xtAssert enhances spring-iogh-1348
  • Loading branch information
Prithvi singh committed May 16, 2023
1 parent 228536b commit 99d38e7
Showing 1 changed file with 0 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,21 +85,4 @@ public GroovyDslGradleBuildAssert hasProperty(String name, String value) {
return contains(String.format("%s = '%s'", name, value));
}

/**
* Assert {@code build.gradle} contains only the specified properties.
* @param values the property value pairs
* @return this for method chaining.
*/
public GroovyDslGradleBuildAssert containsOnlyExtProperties(String... values) {
StringBuilder builder = new StringBuilder(String.format("ext {%n"));
if (values.length % 2 == 1) {
throw new IllegalArgumentException("Size must be even, it is a set of property=value pairs");
}
for (int i = 0; i < values.length; i += 2) {
builder.append(String.format("\tset('%s', \"%s\")%n", values[i], values[i + 1]));
}
builder.append("}");
return contains(builder.toString());
}

}

0 comments on commit 99d38e7

Please sign in to comment.