diff options
author | Manolo Carrasco <manolo@apache.org> | 2014-12-24 19:05:29 +0100 |
---|---|---|
committer | Manolo Carrasco <manolo@apache.org> | 2014-12-25 15:00:26 +0100 |
commit | 44702affcd643c1ddb85c7ac0cce88da75f9a3dc (patch) | |
tree | b1e0d93d21477ba176b485eda93037ad67f8d593 /gwtquery-core/src/test/java | |
parent | b0f52ef82a0e432eeab694add4924b21d103bdd6 (diff) | |
download | gwtquery-44702affcd643c1ddb85c7ac0cce88da75f9a3dc.tar.gz gwtquery-44702affcd643c1ddb85c7ac0cce88da75f9a3dc.zip |
Fix client-side code
Signed-off-by: Manolo Carrasco <manolo@apache.org>
Diffstat (limited to 'gwtquery-core/src/test/java')
-rw-r--r-- | gwtquery-core/src/test/java/com/google/gwt/query/client/dbinding/DataBindingTestJre.java | 20 | ||||
-rw-r--r-- | gwtquery-core/src/test/java/com/google/gwt/query/vm/JsonFactoryParseTest.java | 52 |
2 files changed, 6 insertions, 66 deletions
diff --git a/gwtquery-core/src/test/java/com/google/gwt/query/client/dbinding/DataBindingTestJre.java b/gwtquery-core/src/test/java/com/google/gwt/query/client/dbinding/DataBindingTestJre.java index be0a83f7..5aeaacb7 100644 --- a/gwtquery-core/src/test/java/com/google/gwt/query/client/dbinding/DataBindingTestJre.java +++ b/gwtquery-core/src/test/java/com/google/gwt/query/client/dbinding/DataBindingTestJre.java @@ -15,7 +15,6 @@ */ package com.google.gwt.query.client.dbinding; -import com.google.gwt.core.shared.GWT; import com.google.gwt.junit.client.GWTTestCase; import com.google.gwt.query.client.Function; import com.google.gwt.query.client.GQ; @@ -23,8 +22,6 @@ import com.google.gwt.query.client.IsProperties; import com.google.gwt.query.client.builders.JsonBuilder; import com.google.gwt.query.client.builders.Name; -import java.io.ByteArrayOutputStream; -import java.io.PrintStream; import java.util.Arrays; import java.util.Date; import java.util.List; @@ -153,46 +150,41 @@ public class DataBindingTestJre extends GWTTestCase { assertEquals(1, c.<Number>get("a").intValue()); } - + public interface GUser extends JsonBuilder{ int getAge(); void setAge(int age); String getName(); void setName(String name); - + GUser address(String address); String address(); } - + public static final String JSON_USER_EXAMPLE = " { " + " 'email': 'foo@bar.com', " + " 'age': 27, " + " 'name': 'Foo Bar', " + " 'address': 'Street Foo N6' " + " }"; - + public void test_parse_json() { GUser entity = GQ.create(GUser.class); entity.parse(JSON_USER_EXAMPLE, true); - + assertEquals(27, entity.getAge()); assertEquals("Foo Bar", entity.getName()); assertEquals("Street Foo N6", entity.address()); assertTrue(entity.toJson().contains("email")); } - + public void test_parse_strict_json() { GUser entity = GQ.create(GUser.class); entity.parse(JSON_USER_EXAMPLE, true); - for(String s: entity.getFieldNames()) { - System.out.println("Moe: "+s); - } - entity.strip(); - System.out.println(entity.toJson()); assertEquals(27, entity.getAge()); assertEquals("Foo Bar", entity.getName()); assertEquals("Street Foo N6", entity.address()); diff --git a/gwtquery-core/src/test/java/com/google/gwt/query/vm/JsonFactoryParseTest.java b/gwtquery-core/src/test/java/com/google/gwt/query/vm/JsonFactoryParseTest.java deleted file mode 100644 index b4ea332f..00000000 --- a/gwtquery-core/src/test/java/com/google/gwt/query/vm/JsonFactoryParseTest.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.google.gwt.query.vm; - -import com.google.gwt.query.client.GQ; -import com.google.gwt.query.client.builders.JsonBuilder; - -import org.junit.Assert; -import org.junit.Test; - -public class JsonFactoryParseTest { - - public interface GUser extends JsonBuilder{ - int getAge(); - void setAge(int age); - - String getName(); - void setName(String name); - - GUser address(String address); - String address(); - } - - public static final String JSON_USER_EXAMPLE = " { " + - " 'email': 'foo@bar.com', " + - " 'age': 27, " + - " 'name': 'Foo Bar', " + - " 'address': 'Street Foo N6' " + - " }"; - - @Test public void - test_parse_json() { - GUser entity = GQ.create(GUser.class); - entity.parse(JSON_USER_EXAMPLE); - - Assert.assertEquals(27, entity.getAge()); - Assert.assertEquals("Foo Bar", entity.getName()); - Assert.assertEquals("Street Foo N6", entity.address()); - Assert.assertTrue(entity.toJson().contains("email")); - } - - @Test public void - test_parse_strict_json() { - GUser entity = GQ.create(GUser.class); - entity.parse(JSON_USER_EXAMPLE); - entity.strip(); - System.out.println(entity.toJson()); - Assert.assertEquals(27, entity.getAge()); - Assert.assertEquals("Foo Bar", entity.getName()); - Assert.assertEquals("Street Foo N6", entity.address()); - Assert.assertFalse(entity.toJson().contains("email")); - } - -} |