ContainsFunction implements DDMExpressionFunction.Function2<Object, String, Boolean> { @Override public Boolean apply(Object object, String key) { if (object == null) { return false; } if (object instanceof JSONArray) { return apply(object.toString(), key); } if (object instanceof String) { return apply((String)object, key); } return false; }  @Override Boolean apply(Object object, String key); @Override String getName(); static final String NAME; }
@Test public void testApplyFalse() { ContainsFunction containsFunction = new ContainsFunction(); Boolean result = containsFunction.apply("liferay", "forms"); Assert.assertFalse(result); }
@Test public void testApplyTrue() { ContainsFunction containsFunction = new ContainsFunction(); Boolean result = containsFunction.apply("liferayFORMS", "forms"); Assert.assertTrue(result); }
@Test public void testApplyWithNull1() { ContainsFunction containsFunction = new ContainsFunction(); Boolean result = containsFunction.apply(null, "forms"); Assert.assertFalse(result); }
@Test public void testApplyWithNull2() { ContainsFunction containsFunction = new ContainsFunction(); Boolean result = containsFunction.apply("liferay", null); Assert.assertFalse(result); }