Showing results for 
Search instead for 
Did you mean: 

JTest and delayed Property evaluation expressions


I have a pretty simple snap that takes an input payload and performs an operation the payload, starting at a node specified using a “mapping root” property exactly like the Mapper snap. The snap works fine when testing it manually in the UI.

I am trying to use JTest to create unit tests for this snap but when I specify the value for the mapping root in the properties file, the code is getting the literal string instead of the Map<String, Object> of the node specified.

My property file looks like this:

  "settings": {
    "mappingRoot": {
      "value": "$field2"

In my custom snap, my defineProperties() method does this:


My configure() method does this (mappingRootProperty is of type ExpressionProperty):

        mappingRootProperty = propertyValues.getAsExpression(MAPPING_ROOT_PROPERTY);

And my process() method does this (mappingRoot is of type Object):

        mappingRoot = mappingRootProperty.eval(document);

When run in the UI, mapping root is a Map<String, Object> containing the subtree of the payload assigned to field2. In JTest, mappingRoot is the String “$field2”.

What am I doing wrong? Is this a limitation of the JTest framework?