Package com.firefly.template.support

Examples of com.firefly.template.support.ObjectNavigator.find()


    m1.put("key1", "key1");
    map.put(4, m1);
    Model model = new ModelMock();
    model.put("testMap", map);
    ObjectNavigator o = ObjectNavigator.getInstance();
    Assert.assertThat(o.find(model, "testMap[4]['key1']").toString(), equalTo("key1"));
  }
 
  @Test
  public void testRoot() {
    Map<String, Object> map2 = new HashMap<String, Object>();
View Full Code Here


    model.put("b", map2);
    model.put("arr", arr);
    model.put("list", list);
   
    ObjectNavigator o = ObjectNavigator.getInstance();
    Assert.assertThat(o.find(model, "a").toString(), equalTo("fffff"));
    Assert.assertThat(o.find(model, "b['ccc']").toString(), equalTo("ddd"));
    Assert.assertThat(o.find(model, "b['eee']").toString(), equalTo("fff"));
    Assert.assertThat(o.find(model, "b[\"ccc\"]").toString(), equalTo("ddd"));
    Assert.assertThat((Integer)o.find(model, "arr[2]"), equalTo(333));
    Assert.assertThat(o.find(model, "list[2]").toString(), equalTo("list333"));
View Full Code Here

    model.put("arr", arr);
    model.put("list", list);
   
    ObjectNavigator o = ObjectNavigator.getInstance();
    Assert.assertThat(o.find(model, "a").toString(), equalTo("fffff"));
    Assert.assertThat(o.find(model, "b['ccc']").toString(), equalTo("ddd"));
    Assert.assertThat(o.find(model, "b['eee']").toString(), equalTo("fff"));
    Assert.assertThat(o.find(model, "b[\"ccc\"]").toString(), equalTo("ddd"));
    Assert.assertThat((Integer)o.find(model, "arr[2]"), equalTo(333));
    Assert.assertThat(o.find(model, "list[2]").toString(), equalTo("list333"));
  }
View Full Code Here

    model.put("list", list);
   
    ObjectNavigator o = ObjectNavigator.getInstance();
    Assert.assertThat(o.find(model, "a").toString(), equalTo("fffff"));
    Assert.assertThat(o.find(model, "b['ccc']").toString(), equalTo("ddd"));
    Assert.assertThat(o.find(model, "b['eee']").toString(), equalTo("fff"));
    Assert.assertThat(o.find(model, "b[\"ccc\"]").toString(), equalTo("ddd"));
    Assert.assertThat((Integer)o.find(model, "arr[2]"), equalTo(333));
    Assert.assertThat(o.find(model, "list[2]").toString(), equalTo("list333"));
  }
 
View Full Code Here

   
    ObjectNavigator o = ObjectNavigator.getInstance();
    Assert.assertThat(o.find(model, "a").toString(), equalTo("fffff"));
    Assert.assertThat(o.find(model, "b['ccc']").toString(), equalTo("ddd"));
    Assert.assertThat(o.find(model, "b['eee']").toString(), equalTo("fff"));
    Assert.assertThat(o.find(model, "b[\"ccc\"]").toString(), equalTo("ddd"));
    Assert.assertThat((Integer)o.find(model, "arr[2]"), equalTo(333));
    Assert.assertThat(o.find(model, "list[2]").toString(), equalTo("list333"));
  }
 
  @Test
View Full Code Here

    ObjectNavigator o = ObjectNavigator.getInstance();
    Assert.assertThat(o.find(model, "a").toString(), equalTo("fffff"));
    Assert.assertThat(o.find(model, "b['ccc']").toString(), equalTo("ddd"));
    Assert.assertThat(o.find(model, "b['eee']").toString(), equalTo("fff"));
    Assert.assertThat(o.find(model, "b[\"ccc\"]").toString(), equalTo("ddd"));
    Assert.assertThat((Integer)o.find(model, "arr[2]"), equalTo(333));
    Assert.assertThat(o.find(model, "list[2]").toString(), equalTo("list333"));
  }
 
  @Test
  public void testObject() {
View Full Code Here

    Assert.assertThat(o.find(model, "a").toString(), equalTo("fffff"));
    Assert.assertThat(o.find(model, "b['ccc']").toString(), equalTo("ddd"));
    Assert.assertThat(o.find(model, "b['eee']").toString(), equalTo("fff"));
    Assert.assertThat(o.find(model, "b[\"ccc\"]").toString(), equalTo("ddd"));
    Assert.assertThat((Integer)o.find(model, "arr[2]"), equalTo(333));
    Assert.assertThat(o.find(model, "list[2]").toString(), equalTo("list333"));
  }
 
  @Test
  public void testObject() {
    Foo foo = new Foo();
View Full Code Here

   
    Model model = new ModelMock();
    model.put("foo", foo);
   
    ObjectNavigator o = ObjectNavigator.getInstance();
    Assert.assertThat(String.valueOf(o.find(model, "foo.bar.info")), equalTo("bar1"));
    Assert.assertThat(String.valueOf(o.find(model, "foo.bar.serialNumber")), equalTo("33"));
    Assert.assertThat(String.valueOf(o.find(model, "foo.bar.price")), equalTo("3.3"));
    Assert.assertThat(String.valueOf(o.find(model, "foo.numbers[2]")), equalTo("5"));
    Assert.assertThat(String.valueOf(o.find(model, "foo.map['bar2'].price")), equalTo("2.3"));
    Assert.assertThat(String.valueOf(o.find(model, "foo.map2['map4']['hello4']['hello3']")), equalTo("world3"));
View Full Code Here

    Model model = new ModelMock();
    model.put("foo", foo);
   
    ObjectNavigator o = ObjectNavigator.getInstance();
    Assert.assertThat(String.valueOf(o.find(model, "foo.bar.info")), equalTo("bar1"));
    Assert.assertThat(String.valueOf(o.find(model, "foo.bar.serialNumber")), equalTo("33"));
    Assert.assertThat(String.valueOf(o.find(model, "foo.bar.price")), equalTo("3.3"));
    Assert.assertThat(String.valueOf(o.find(model, "foo.numbers[2]")), equalTo("5"));
    Assert.assertThat(String.valueOf(o.find(model, "foo.map['bar2'].price")), equalTo("2.3"));
    Assert.assertThat(String.valueOf(o.find(model, "foo.map2['map4']['hello4']['hello3']")), equalTo("world3"));
    Assert.assertThat(String.valueOf(o.find(model, "foo.map2['map4']['hello4']['arr'][2]")), equalTo("7"));
View Full Code Here

    model.put("foo", foo);
   
    ObjectNavigator o = ObjectNavigator.getInstance();
    Assert.assertThat(String.valueOf(o.find(model, "foo.bar.info")), equalTo("bar1"));
    Assert.assertThat(String.valueOf(o.find(model, "foo.bar.serialNumber")), equalTo("33"));
    Assert.assertThat(String.valueOf(o.find(model, "foo.bar.price")), equalTo("3.3"));
    Assert.assertThat(String.valueOf(o.find(model, "foo.numbers[2]")), equalTo("5"));
    Assert.assertThat(String.valueOf(o.find(model, "foo.map['bar2'].price")), equalTo("2.3"));
    Assert.assertThat(String.valueOf(o.find(model, "foo.map2['map4']['hello4']['hello3']")), equalTo("world3"));
    Assert.assertThat(String.valueOf(o.find(model, "foo.map2['map4']['hello4']['arr'][2]")), equalTo("7"));
    Assert.assertThat(o.find(model, "foo.map['bar5']"), nullValue());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.