[
https://issues.apache.org/jira/browse/APEXMALHAR-2010?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15201419#comment-15201419
]
ASF GitHub Bot commented on APEXMALHAR-2010:
--------------------------------------------
Github user sandeepdeshmukh commented on a diff in the pull request:
https://github.com/apache/incubator-apex-malhar/pull/209#discussion_r56650866
--- Diff: library/src/test/java/com/datatorrent/lib/util/PojoUtilsTest.java
---
@@ -489,4 +483,59 @@ public void testWrongSetterArgument()
final Class<?> testPojoClass = TestPojo.class;
createSetter(testPojoClass, TestPojo.INT_FIELD_NAME, int.class);
}
+
+ @Test (expected = RuntimeException.class)
+ public void testPrivateFieldExpression()
+ {
+ final Class<?> testPojoClass = TestPojo.class;
+ createExpression(testPojoClass, "privateIntField", int.class);
+ }
+
+ @Test
+ public void testBasicExpression()
+ {
+ TestPojo testObj = new TestPojo(1);
+ Class<?> testObjClass = testObj.getClass();
+
+ assertEquals(testObj.getIntVal(), createExpression(testObjClass,
"intField", int.class).execute(testObj));
+ assertEquals(testObj.getIntVal(), createExpression(testObjClass,
"intVal", int.class).execute(testObj));
+ }
+
+ @Test (expected = RuntimeException.class)
+ public void testPrivateField()
+ {
+ final Class<?> testPojoClass = TestPojo.class;
+ @SuppressWarnings("unused")
+ SetterInt<Object> setterInt = createSetterInt(testPojoClass,
"privateIntField");
+ }
+
+ @Test
+ public void testNestedPOJOExpression()
+ {
+ Expression expression = createExpression(fqcn, "innerObj.boolVal",
boolean.class);
+ assertTrue((Boolean)expression.execute(testObj));
+
+ expression = createExpression(fqcn, "{$.innerObj.boolVal}",
boolean.class);
+ assertTrue((Boolean)expression.execute(testObj));
+
+ expression = createExpression(fqcn, "$.innerObj.boolVal",
boolean.class);
+ assertTrue((Boolean)expression.execute(testObj));
+
+ expression = createExpression(fqcn, "!{$.innerObj.boolVal}",
boolean.class);
+ assertFalse((Boolean)expression.execute(testObj));
+
+ expression = createExpression(fqcn, "!{$}.innerObj.boolVal",
boolean.class);
--- End diff --
Can you put one liner comment on each of the expression that you are
testing.
> Add transform operator
> ----------------------
>
> Key: APEXMALHAR-2010
> URL: https://issues.apache.org/jira/browse/APEXMALHAR-2010
> Project: Apache Apex Malhar
> Issue Type: New Feature
> Components: algorithms
> Affects Versions: 3.4.0
> Reporter: Chinmay Kolhatkar
> Assignee: Chinmay Kolhatkar
>
> Add transform operator
> Details to be added soon once the mailing thread reaching conclusion:
> http://mail-archives.apache.org/mod_mbox/incubator-apex-dev/201603.mbox/%3CCABAipVZUdRGx5dS35bYPN46koLQU5gSLgbCeRH8aM_y9ANRU2w%40mail.gmail.com%3E
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)