Skip to content
Permalink
Browse files

Merge pull request #116 from artem-fedorov/fix-supporting-java-standa…

…rd-types

[JENKINS-31967] Specifying decimal numbers for JUnit health factor in Pipeline snippets results in invalid code
  • Loading branch information...
jglick committed May 30, 2017
2 parents e3bad4b + 7ed2374 commit b48af161645f3a8d37c9d1219d5e65b94b5628bf
@@ -102,7 +102,9 @@ static StringBuilder object2Groovy(StringBuilder b, Object o, boolean nestedExp)
return b;
}

if (clazz == Boolean.class || clazz == Integer.class || clazz == Long.class) {
if (clazz == Boolean.class || clazz == Integer.class || clazz == Long.class ||
clazz == Float.class || clazz == Double.class ||
clazz == Byte.class || clazz == Short.class) {
return b.append(o);
}

@@ -33,6 +33,7 @@
import hudson.model.StringParameterDefinition;
import hudson.model.StringParameterValue;
import hudson.tasks.ArtifactArchiver;
import hudson.tasks.junit.JUnitResultArchiver;
import org.jenkinsci.Symbol;
import org.jenkinsci.plugins.structs.describable.DescribableModel;
import org.jenkinsci.plugins.workflow.cps.steps.ParallelStep;
@@ -347,4 +348,13 @@ public void coreStepDocs() throws Exception {
public void parallelStepDocs() throws Exception {
SnippetizerTester.assertDocGeneration(ParallelStep.class);
}


@Issue("JENKINS-31967")
@Test public void testStandardJavaTypes() throws Exception {
JUnitResultArchiver a = new JUnitResultArchiver("*.xml");
st.assertRoundTrip(new CoreStep(a), "junit '*.xml'");
a.setHealthScaleFactor(0.5);
st.assertRoundTrip(new CoreStep(a), "junit healthScaleFactor: 0.5, testResults: '*.xml'");
}
}

0 comments on commit b48af16

Please sign in to comment.
You can’t perform that action at this time.