Incorporated Ray's feedback on http://code.google.com/p/google-web-toolkit/source/detail?r=8533
Fixed the comment in RequestFactoryJreSuite and added a test to RecordKeyTest.
Patch by: amitmanjhi
Review by: rjrjr
Review at http://gwt-code-reviews.appspot.com/768801
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@8539 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/test/com/google/gwt/requestfactory/RequestFactoryJreSuite.java b/user/test/com/google/gwt/requestfactory/RequestFactoryJreSuite.java
index b816af2..76b5b41 100644
--- a/user/test/com/google/gwt/requestfactory/RequestFactoryJreSuite.java
+++ b/user/test/com/google/gwt/requestfactory/RequestFactoryJreSuite.java
@@ -23,7 +23,7 @@
import junit.framework.TestSuite;
/**
- * Suite of UiBinder tests that require the JRE.
+ * Suite of RequestFactory tests that require the JRE.
*/
public class RequestFactoryJreSuite {
public static Test suite() {
diff --git a/user/test/com/google/gwt/requestfactory/client/impl/RecordKeyTest.java b/user/test/com/google/gwt/requestfactory/client/impl/RecordKeyTest.java
index 6eaffa1..c61dad7 100644
--- a/user/test/com/google/gwt/requestfactory/client/impl/RecordKeyTest.java
+++ b/user/test/com/google/gwt/requestfactory/client/impl/RecordKeyTest.java
@@ -25,20 +25,25 @@
public void testEquals() {
RecordKey newKey1 = new RecordKey(1L, SimpleFooRecordImpl.SCHEMA,
RequestFactoryJsonImpl.IS_FUTURE);
- RecordKey newKey2 = new RecordKey(newKey1.id + 1, newKey1.schema,
- newKey1.isFuture);
- RecordKey oldKey1 = new RecordKey(newKey1.id, newKey1.schema,
- !newKey1.isFuture);
+
RecordKey anotherNewKey1 = new RecordKey(newKey1.id, newKey1.schema,
newKey1.isFuture);
-
assertTrue(newKey1.equals(anotherNewKey1));
assertTrue(newKey1.hashCode() == anotherNewKey1.hashCode());
-
+
+ RecordKey newKey2 = new RecordKey(newKey1.id + 1, newKey1.schema,
+ newKey1.isFuture);
assertFalse(newKey1.equals(newKey2));
assertFalse(newKey1.hashCode() == newKey2.hashCode());
-
+
+ RecordKey newKey1NoSchema = new RecordKey(newKey1.id,
+ SimpleBazRecordImpl.SCHEMA, newKey1.isFuture);
+ assertFalse(newKey1.equals(newKey1NoSchema));
+ assertFalse(newKey1.hashCode() == newKey1NoSchema.hashCode());
+
+ RecordKey oldKey1 = new RecordKey(newKey1.id, newKey1.schema,
+ !newKey1.isFuture);
assertFalse(newKey1.equals(oldKey1));
- assertFalse(newKey1.hashCode() == newKey2.hashCode());
+ assertFalse(newKey1.hashCode() == oldKey1.hashCode());
}
}
diff --git a/user/test/com/google/gwt/requestfactory/client/impl/SimpleBazRecordImpl.java b/user/test/com/google/gwt/requestfactory/client/impl/SimpleBazRecordImpl.java
new file mode 100644
index 0000000..876478f
--- /dev/null
+++ b/user/test/com/google/gwt/requestfactory/client/impl/SimpleBazRecordImpl.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.requestfactory.client.impl;
+
+import com.google.gwt.valuestore.shared.Property;
+import com.google.gwt.valuestore.shared.Record;
+import com.google.gwt.valuestore.shared.RecordChangedEvent;
+import com.google.gwt.valuestore.shared.WriteOperation;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * Just a dummy class for testing purposes.
+ */
+public class SimpleBazRecordImpl extends RecordImpl {
+
+ /**
+ * The Schema class.
+ */
+ public static class MySchema extends RecordSchema<SimpleBazRecordImpl> {
+ private final Set<Property<?>> allProperties;
+ {
+ Set<Property<?>> set = new HashSet<Property<?>>();
+ set.addAll(super.allProperties());
+ allProperties = Collections.unmodifiableSet(set);
+ }
+
+ @Override
+ public Set<Property<?>> allProperties() {
+ return allProperties;
+ }
+
+ @Override
+ public SimpleBazRecordImpl create(RecordJsoImpl jso, boolean isFuture) {
+ return new SimpleBazRecordImpl(jso, isFuture);
+ }
+
+ @Override
+ public RecordChangedEvent<?, ?> createChangeEvent(Record record,
+ WriteOperation writeOperation) {
+ // ignore
+ return null;
+ }
+
+ @Override
+ public Class<? extends Record> getToken() {
+ // ignore
+ return null;
+ }
+ }
+
+ public static final RecordSchema<SimpleBazRecordImpl> SCHEMA = new MySchema();
+
+ private SimpleBazRecordImpl(RecordJsoImpl jso, boolean isFuture) {
+ super(jso, isFuture);
+ }
+}