Test to verify serialization of array of strings is OK.
authorJaroslav Tulach <jaroslav.tulach@netbeans.org>
Tue, 21 Jan 2014 13:08:47 +0100
changeset 47972fca24897e7
parent 473 4f02ac8ef70a
child 480 929fe7cc911b
Test to verify serialization of array of strings is OK.
json/src/test/java/org/netbeans/html/json/impl/JSONListTest.java
     1.1 --- a/json/src/test/java/org/netbeans/html/json/impl/JSONListTest.java	Tue Jan 21 09:05:01 2014 +0100
     1.2 +++ b/json/src/test/java/org/netbeans/html/json/impl/JSONListTest.java	Tue Jan 21 13:08:47 2014 +0100
     1.3 @@ -45,9 +45,11 @@
     1.4  import java.util.HashMap;
     1.5  import java.util.Map;
     1.6  import net.java.html.BrwsrCtx;
     1.7 +import net.java.html.json.Model;
     1.8  import net.java.html.json.Models;
     1.9  import net.java.html.json.People;
    1.10  import net.java.html.json.Person;
    1.11 +import net.java.html.json.Property;
    1.12  import net.java.html.json.Sex;
    1.13  import org.apidesign.html.context.spi.Contexts;
    1.14  import org.apidesign.html.json.spi.FunctionBinding;
    1.15 @@ -61,6 +63,9 @@
    1.16   *
    1.17   * @author Jaroslav Tulach <jtulach@netbeans.org>
    1.18   */
    1.19 +@Model(className = "JSNLst", properties = {
    1.20 +    @Property(name = "names", type = String.class, array = true)
    1.21 +})
    1.22  public class JSONListTest implements Technology<Object> {
    1.23      private boolean replaceArray;
    1.24      private final Map<String,PropertyBinding> bindings = new HashMap<String,PropertyBinding>();
    1.25 @@ -151,6 +156,11 @@
    1.26          
    1.27          assertEquals(pb.getValue(), this, "I am the model of the array");
    1.28      }
    1.29 +    
    1.30 +    @Test public void toStringOnArrayOfStrings() {
    1.31 +        JSNLst l = new JSNLst("Jarda", "Jirka", "Parda");
    1.32 +        assertEquals(l.toString(), "{\"names\":[\"Jarda\",\"Jirka\",\"Parda\"]}", "Properly quoted");
    1.33 +    }
    1.34  
    1.35      @Override
    1.36      public Object wrapModel(Object model) {