-
Notifications
You must be signed in to change notification settings - Fork 0
/
SerializationUtilGwtTest.java
44 lines (36 loc) · 1.71 KB
/
SerializationUtilGwtTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package org.wwarn.surveyor.util.client;
import com.google.gwt.core.client.GWT;
import com.google.gwt.junit.client.GWTTestCase;
import com.google.gwt.user.client.rpc.SerializationException;
import com.seanchenxi.gwt.storage.client.serializer.StorageSerializer;
public class SerializationUtilGwtTest extends GWTTestCase {
@Override
public String getModuleName() {
return "org.wwarn.surveyor.util.SerializationUtilTest";
}
public void testSerializationUtil() throws Exception {
delayTestFinish(5000);
SerializationUtil storageSerializer = GWT.create(SerializationUtil.class);
final TestValue testValue = new TestValue("foo");
String serializedString = storageSerializer.serialize(TestValue.class, testValue);
assertNotNull(serializedString);
final SimplePojo object = new SimplePojo("foo", "bar");
serializedString = storageSerializer.serialize(SimplePojo.class, object);
assertNotNull(serializedString);
finishTest();
}
public void testSerializerDirectly() throws SerializationException {
StorageSerializer storageSerializer =
GWT.create(StorageSerializer.class)
// new com.seanchenxi.gwt.storage.client.serializer.StorageRPCSerializerImpl()
;
delayTestFinish(5000);
final TestValue testValue = new TestValue("foo");
String serializedString = storageSerializer.serialize(TestValue.class, testValue);
assertNotNull(serializedString);
final SimplePojo object = new SimplePojo("foo", "bar");
serializedString = storageSerializer.serialize(SimplePojo.class, object);
assertNotNull(serializedString);
finishTest();
}
}