diff --git a/src/test/java/hudson/plugins/git/extensions/impl/CloneOptionHonorRefSpecTest.java b/src/test/java/hudson/plugins/git/extensions/impl/CloneOptionHonorRefSpecTest.java index a339dfc7ce..665ae289d3 100644 --- a/src/test/java/hudson/plugins/git/extensions/impl/CloneOptionHonorRefSpecTest.java +++ b/src/test/java/hudson/plugins/git/extensions/impl/CloneOptionHonorRefSpecTest.java @@ -84,7 +84,7 @@ public void setUp() throws Exception { List logs = b.getLog(50); for (String line : logs) { if (line.startsWith(refSpecName + '=')) { - refSpecExpectedValue = line.split("=")[1]; + refSpecExpectedValue = line.substring(refSpecName.length() + 1, line.length()); } } @@ -103,6 +103,12 @@ public void setUp() throws Exception { @Test @Issue("JENKINS-56063") public void testRefSpecWithExpandedVariables() throws Exception { + if (refSpecExpectedValue == null || refSpecExpectedValue.isEmpty()) { + /* Test does not support an empty or null expected value. + Skip the test if the expected value is empty or null */ + System.out.println("*** testRefSpecWithExpandedVariables empty expected value for '" + refSpecName + "' ***"); + return; + } // Create initial commit final String commitFile1 = "commitFile1"; commit(commitFile1, johnDoe, "Commit in master branch");