FreeMarker test
authorJulia Baudier <jbaudier@argeo.org>
Thu, 21 Mar 2019 08:59:02 +0000 (09:59 +0100)
committerJulia Baudier <jbaudier@argeo.org>
Thu, 21 Mar 2019 08:59:02 +0000 (09:59 +0100)
org.argeo.core/src/org/argeo/fm/Animal.java [new file with mode: 0644]
org.argeo.core/src/org/argeo/fm/TestFreeMarker.java

diff --git a/org.argeo.core/src/org/argeo/fm/Animal.java b/org.argeo.core/src/org/argeo/fm/Animal.java
new file mode 100644 (file)
index 0000000..946087c
--- /dev/null
@@ -0,0 +1,29 @@
+package org.argeo.fm;
+
+public class Animal {
+       String size;
+       int price;
+
+       public Animal(String size, int price) {
+               super();
+               this.size = size;
+               this.price = price;
+       }
+
+       public String getSize() {
+               return size;
+       }
+
+       public void setSize(String size) {
+               this.size = size;
+       }
+
+       public int getPrice() {
+               return price;
+       }
+
+       public void setPrice(int price) {
+               this.price = price;
+       }
+
+}
\ No newline at end of file
index a0c1c48e9b187280b0928853aba3e7f8feccfb08..96c0a21e4ffbd8749beb773b90ff60e3ddb4336d 100644 (file)
@@ -43,6 +43,14 @@ public class TestFreeMarker {
                        latest.setName("green mouse");
                        root.put("latestProduct", latest);
 
+                       root.put("message", "It's a test");
+
+                       Map<String, Animal> animals = new HashMap<>();
+                       animals.put("mouse", new Animal("small", 50));
+                       animals.put("elephant", new Animal("big", 2000));
+                       animals.put("dog", new Animal("medium", 150));
+                       root.put("animals", animals);
+
                        /* Get the template (uses cache internally) */
                        Template temp = cfg.getTemplate(template);