apex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chinmaykolhatkar <...@git.apache.org>
Subject [GitHub] incubator-apex-malhar pull request: APEXMALHAR-2010 Add Tranform o...
Date Mon, 21 Mar 2016 07:08:42 GMT
Github user chinmaykolhatkar commented on a diff in the pull request:

    https://github.com/apache/incubator-apex-malhar/pull/209#discussion_r56787093
  
    --- 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 --
    
    Done.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message