Skip to content

Commit 8c62d00

Browse files
committed
Use matching instead of if
1 parent bc6b6c8 commit 8c62d00

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

build-tools/src/main/java/org/elasticsearch/gradle/test/TestBuildInfoPlugin.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,8 @@ public void apply(Project project) {
5757
task.into("META-INF", copy -> copy.from(testBuildInfoTask));
5858
});
5959

60-
project.getTasks().withType(Test.class).configureEach(test -> {
61-
if (List.of("test").contains(test.getName())) {
62-
test.systemProperty("es.entitlement.enableForTests", "true");
63-
}
60+
project.getTasks().withType(Test.class).matching(test -> List.of("test").contains(test.getName())).configureEach(test -> {
61+
test.systemProperty("es.entitlement.enableForTests", "true");
6462
});
6563
}
6664
}

libs/build.gradle

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,8 @@ configure(childProjects.values()) {
5050
// Omit oddball libraries that aren't in server.
5151
def nonServerLibs = Set.of('plugin-scanner')
5252
if (false == nonServerLibs.contains(project.name)) {
53-
project.getTasks().withType(Test.class).configureEach(test -> {
54-
if (List.of('test').contains(test.getName())) {
55-
test.systemProperty('es.entitlement.enableForTests', 'true')
56-
}
53+
project.getTasks().withType(Test.class).matching(test -> List.of('test').contains(test.getName())).configureEach(test -> {
54+
test.systemProperty('es.entitlement.enableForTests', 'true')
5755
})
5856
}
5957

0 commit comments

Comments
 (0)