From 6dd4a21fe881347499b0a8abeeed55f0aaec6926 Mon Sep 17 00:00:00 2001 From: Raihaan Shouhell Date: Tue, 11 May 2021 04:13:29 +0800 Subject: [PATCH] Fix test for future versions of jenkins - PCT failures (#90) --- .../structs/describable/DescribableModelTest.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/plugin/src/test/java/org/jenkinsci/plugins/structs/describable/DescribableModelTest.java b/plugin/src/test/java/org/jenkinsci/plugins/structs/describable/DescribableModelTest.java index 1616eb3..1bb6649 100644 --- a/plugin/src/test/java/org/jenkinsci/plugins/structs/describable/DescribableModelTest.java +++ b/plugin/src/test/java/org/jenkinsci/plugins/structs/describable/DescribableModelTest.java @@ -36,6 +36,9 @@ import hudson.plugins.git.UserMergeOptions; import hudson.plugins.git.extensions.impl.CleanBeforeCheckout; import java.util.HashMap; + +import hudson.util.VersionNumber; +import jenkins.model.Jenkins; import org.codehaus.groovy.runtime.GStringImpl; import org.hamcrest.Matchers; import org.jenkinsci.plugins.structs.Fishing; @@ -647,9 +650,15 @@ public static final class TakesParams { } @Test public void parametersDefinitionProperty() throws Exception { - roundTrip(ParametersDefinitionProperty.class, map("parameterDefinitions", Arrays.asList( - map(CLAZZ, "BooleanParameterDefinition", "name", "flag", "defaultValue", false), - map(CLAZZ, "StringParameterDefinition", "name", "text", "trim", false)))); + if (Jenkins.getVersion().isNewerThanOrEqualTo(new VersionNumber("2.281"))) { + roundTrip(ParametersDefinitionProperty.class, map("parameterDefinitions", Arrays.asList( + map(CLAZZ, "BooleanParameterDefinition", "name", "flag"), + map(CLAZZ, "StringParameterDefinition", "name", "text")))); + } else { + roundTrip(ParametersDefinitionProperty.class, map("parameterDefinitions", Arrays.asList( + map(CLAZZ, "BooleanParameterDefinition", "name", "flag", "defaultValue", false), + map(CLAZZ, "StringParameterDefinition", "name", "text", "trim", false)))); + } } @Issue("JENKINS-26619")