summaryrefslogtreecommitdiffstats
path: root/infra/test-utils/test-tools
diff options
context:
space:
mode:
authorJan Srnicek <jsrnicek@cisco.com>2017-02-21 10:41:17 +0100
committerJan Srnicek <jsrnicek@cisco.com>2017-02-21 10:41:17 +0100
commit309d5e1561ba42ee491fa33c3b8c24849dc003fa (patch)
treec333216092ca786af65cee117065a8178c09021c /infra/test-utils/test-tools
parent14c47d940c385ee563134a2708eac64e0d718204 (diff)
Resource nullability check for test runner
checks if provided resource path was found Change-Id: I86ed1b6f38bc8f48fd12ebe8620831862840ed11 Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
Diffstat (limited to 'infra/test-utils/test-tools')
-rw-r--r--infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/ContainerNodeDataProcessor.java2
-rw-r--r--infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/ListNodeDataProcessor.java3
2 files changed, 5 insertions, 0 deletions
diff --git a/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/ContainerNodeDataProcessor.java b/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/ContainerNodeDataProcessor.java
index 089bb43cd..b7641e01d 100644
--- a/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/ContainerNodeDataProcessor.java
+++ b/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/ContainerNodeDataProcessor.java
@@ -48,6 +48,8 @@ final class ContainerNodeDataProcessor extends AbstractYangContextHolder impleme
public DataObject getNodeData(@Nonnull YangInstanceIdentifier yangInstanceIdentifier, @Nonnull String resourcePath) {
final InputStream resourceStream = this.getClass().getResourceAsStream(resourcePath);
+ checkState(resourceStream != null, "Resource %s not found", resourcePath);
+
final YangInstanceIdentifier nodeParent = getNodeParent(yangInstanceIdentifier).orElse(null);
final SchemaNode parentSchema = parentSchema(schemaContext(), serializer(), nodeParent, () -> LOG);
diff --git a/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/ListNodeDataProcessor.java b/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/ListNodeDataProcessor.java
index 375f55307..c14ea354e 100644
--- a/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/ListNodeDataProcessor.java
+++ b/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/ListNodeDataProcessor.java
@@ -30,6 +30,7 @@ import javax.annotation.Nonnull;
import java.io.InputStream;
import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkState;
import static io.fd.honeycomb.translate.util.JsonUtils.readListEntryFromJson;
/**
@@ -52,6 +53,8 @@ final class ListNodeDataProcessor extends AbstractYangContextHolder implements Y
final YangInstanceIdentifier listParent = listNodeParent(nodeIdentifier);
final YangInstanceIdentifier.NodeIdentifierWithPredicates keyedNodeIdentifier = listNodeIdentifier(nodeIdentifier);
final InputStream resourceStream = this.getClass().getResourceAsStream(resourcePath);
+ checkState(resourceStream != null, "Resource %s not found", resourcePath);
+
final SchemaNode parentSchemaNode = parentSchema(schemaContext(), serializer(), listParent, () -> LOG);
final MapEntryNode data = readListEntryFromJson(schemaContext(), resourceStream, parentSchemaNode, keyedNodeIdentifier);