This is an automated email from the ASF dual-hosted git repository.
mcasters pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hop.git
The following commit(s) were added to refs/heads/master by this push:
new 3a66dbcf7c Fixes #1905 : NPE running UnitTest with invalid test
new 314ecd3fb3 Merge pull request #1908 from uraychang/master
3a66dbcf7c is described below
commit 3a66dbcf7cb1c28f86bd630def701af4f2286225
Author: ray.chang <[email protected]>
AuthorDate: Mon Dec 5 15:53:55 2022 +0800
Fixes #1905 : NPE running UnitTest with invalid test
---
.../org/apache/hop/testing/actions/runtests/RunPipelineTests.java | 7 +++++--
.../src/main/java/org/apache/hop/testing/util/UnitTestUtil.java | 4 ++++
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git
a/plugins/misc/testing/src/main/java/org/apache/hop/testing/actions/runtests/RunPipelineTests.java
b/plugins/misc/testing/src/main/java/org/apache/hop/testing/actions/runtests/RunPipelineTests.java
index 8c822f6683..86951da0d2 100644
---
a/plugins/misc/testing/src/main/java/org/apache/hop/testing/actions/runtests/RunPipelineTests.java
+++
b/plugins/misc/testing/src/main/java/org/apache/hop/testing/actions/runtests/RunPipelineTests.java
@@ -115,8 +115,11 @@ public class RunPipelineTests extends ActionBase
implements IAction, Cloneable {
}
},
(test1, pipelineMeta, e) -> {
- this.logError(
- "There was an exception executing pipeline unit test '" +
test.getName(), e);
+ if (test == null) {
+ this.logError("Unable to load unit test for '" + testName, e);
+ } else {
+ this.logError("There was an exception executing pipeline unit
test '" + test.getName(), e);
+ }
success.set(false);
});
}
diff --git
a/plugins/misc/testing/src/main/java/org/apache/hop/testing/util/UnitTestUtil.java
b/plugins/misc/testing/src/main/java/org/apache/hop/testing/util/UnitTestUtil.java
index 18e40ee940..2b0f864671 100644
---
a/plugins/misc/testing/src/main/java/org/apache/hop/testing/util/UnitTestUtil.java
+++
b/plugins/misc/testing/src/main/java/org/apache/hop/testing/util/UnitTestUtil.java
@@ -38,6 +38,10 @@ public class UnitTestUtil {
public static final PipelineMeta loadTestPipeline(
PipelineUnitTest test, IHopMetadataProvider metadataProvider, IVariables
variables)
throws HopException {
+ if (test == null) {
+ throw new HopException("Unable to find a valid unit test");
+ }
+
PipelineMeta unitTestPipelineMeta = null;
// Environment substitution is not yet supported in the UI
//