From 886669a199aa30665f70efe21abb5a3f49fe4b04 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Fri, 16 Jun 2023 06:57:46 -0400 Subject: [PATCH] Avoid calling `TransientActionFactory` from `SCMRevisionActionTest` mock (#215) --- src/test/java/jenkins/scm/api/SCMRevisionActionTest.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/test/java/jenkins/scm/api/SCMRevisionActionTest.java b/src/test/java/jenkins/scm/api/SCMRevisionActionTest.java index d93f01ba..21ce72c9 100644 --- a/src/test/java/jenkins/scm/api/SCMRevisionActionTest.java +++ b/src/test/java/jenkins/scm/api/SCMRevisionActionTest.java @@ -1,6 +1,9 @@ package jenkins.scm.api; +import hudson.model.Action; import hudson.model.Actionable; +import java.util.List; +import java.util.stream.Collectors; import jenkins.scm.impl.mock.MockSCMController; import jenkins.scm.impl.mock.MockSCMDiscoverBranches; import jenkins.scm.impl.mock.MockSCMHead; @@ -77,5 +80,11 @@ public String getDisplayName() { public String getSearchUrl() { return null; } + + @SuppressWarnings("deprecation") // avoid TransientActionFactory + @Override + public List getActions(Class type) { + return getActions().stream().filter(type::isInstance).map(type::cast).collect(Collectors.toList()); + } } }