Skip to content

Commit

Permalink
Merge pull request #116 from artem-fedorov/fix-supporting-java-standa…
Browse files Browse the repository at this point in the history
…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 b48af16
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Expand Up @@ -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);
}

Expand Down
Expand Up @@ -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;
Expand Down Expand Up @@ -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.