]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-236: Changes to serializer test class to reflect ongoing transition from ID...
authorAron Roberts <aron@socrates.berkeley.edu>
Wed, 12 Aug 2009 01:33:34 +0000 (01:33 +0000)
committerAron Roberts <aron@socrates.berkeley.edu>
Wed, 12 Aug 2009 01:33:34 +0000 (01:33 +0000)
services/id/service/src/main/java/org/collectionspace/services/id/IDGeneratorSerializer.java
services/id/service/src/test/java/org/collectionspace/services/id/test/IDGeneratorSerializerTest.java [moved from services/id/service/src/test/java/org/collectionspace/services/id/test/IDPatternSerializerTest.java with 64% similarity]

index 1556996e7e9d4d6ac5cd9b5fbca3c74865e3cfbb..ada47f8bcc5302429aca039060e73b6acb3d29e5 100644 (file)
@@ -103,7 +103,7 @@ public class IDGeneratorSerializer {
 
     IDPattern pattern;
     try {
-      pattern = (IDPattern) xstream.fromXML(serializedPattern);
+      pattern = (IDPattern) xstream.fromXML(serializedGenerator);
     } catch (XStreamException e) {
            throw new IllegalArgumentException(
              "Could not understand or parse this representation of an ID generator.");
similarity index 64%
rename from services/id/service/src/test/java/org/collectionspace/services/id/test/IDPatternSerializerTest.java
rename to services/id/service/src/test/java/org/collectionspace/services/id/test/IDGeneratorSerializerTest.java
index 57ccff68c1a797b20c4d8625d0f17a3139cff7fb..78cac20d07cd5ceb55d4def7f0ae95087df6f324 100644 (file)
@@ -1,8 +1,4 @@
 /**
- * IDPatternSerializerTest
- *
- * Unit tests of the ID Service's IDPatternSerializer class.
- *
  * This document is a part of the source code and related artifacts
  * for CollectionSpace, an open source collections management system
  * for museums and related institutions:
  * You may obtain a copy of the ECL 2.0 License at
  * https://source.collectionspace.org/collection-space/LICENSE.txt
  *
- * $LastChangedBy: aron $
- * $LastChangedRevision: 302 $
- * $LastChangedDate$
+ * 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 org.collectionspace.services.id.test;
@@ -30,14 +28,24 @@ import org.collectionspace.services.id.*;
 import junit.framework.TestCase;
 import static org.junit.Assert.*;
 
-public class IDPatternSerializerTest extends TestCase {
+/**
+ * IDGeneratorSerializerTest
+ *
+ * Unit tests of the ID Service's IDGeneratorSerializer class.
+ *
+ *
+ * $LastChangedBy: aron $
+ * $LastChangedRevision: 302 $
+ * $LastChangedDate$
+ */
+public class IDGeneratorSerializerTest extends TestCase {
 
-  String serializedPattern;
+  String serializedGenerator;
   IDPattern pattern;
   
        final static String DEFAULT_CSID = "TEST-1";
 
-  final static String DEFAULT_SERIALIZED_ID_PATTERN =
+  final static String DEFAULT_SERIALIZED_ID_GENERATOR =
     "<org.collectionspace.services.id.IDPattern>\n" +
     "  <csid>" + DEFAULT_CSID + "</csid>\n" +
     "  <uri></uri>\n" +
@@ -48,40 +56,40 @@ public class IDPatternSerializerTest extends TestCase {
   // @TODO We may want to canonicalize (or otherwise normalize) the expected and
   // actual XML in these tests, to avoid failures resulting from differences in
   // whitespace, etc.
-       public void testSerializeIDPattern() {
+       public void testSerializeIDGenerator() {
          IDPattern pattern = new IDPattern(DEFAULT_CSID);
-               assertEquals(DEFAULT_SERIALIZED_ID_PATTERN, IDPatternSerializer.serialize(pattern));
+               assertEquals(DEFAULT_SERIALIZED_ID_GENERATOR, IDGeneratorSerializer.serialize(pattern));
        }
 
-       public void testSerializeNullIDPattern() {
+       public void testSerializeNullIDGenerator() {
          try {
-           String serializedPattern = IDPatternSerializer.serialize(null);
+           String serializedPattern = IDGeneratorSerializer.serialize(null);
                        fail("Should have thrown IllegalArgumentException here");
                } catch (IllegalArgumentException expected) {
                        // This Exception should be thrown, and thus the test should pass.
                }
        }
 
-       public void testDeserializeIDPattern() {
+       public void testDeserializeIDGenerator() {
          // This test will fail with different hash codes unless we add an IDPattern.equals()
          // method that explicitly defines object equality as, for instance, having identical values
          // in each of its instance variables.
-         // IDPattern pattern = IDPatternSerializer.deserialize(DEFAULT_SERIALIZED_ID_PATTERN);
+         // IDPattern pattern = IDGeneratorSerializer.deserialize(DEFAULT_SERIALIZED_ID_PATTERN);
          // assertEquals(pattern, new IDPattern(DEFAULT_CSID));
        }
 
-       public void testDeserializeNullSerializedIDPattern() {
+       public void testDeserializeNullSerializedIDGenerator() {
          try {
-           IDPattern pattern = IDPatternSerializer.deserialize(null);
+           IDPattern pattern = IDGeneratorSerializer.deserialize(null);
                        fail("Should have thrown IllegalArgumentException here");
                } catch (IllegalArgumentException expected) {
                        // This Exception should be thrown, and thus the test should pass.
                }
        }
 
-       public void testDeserializeInvalidSerializedIDPattern() {
+       public void testDeserializeInvalidSerializedIDGenerator() {
          try {
-           IDPattern pattern = IDPatternSerializer.deserialize("<invalid_serialized_pattern/>");
+           IDPattern pattern = IDGeneratorSerializer.deserialize("<invalid_serialized_generator/>");
                        fail("Should have thrown IllegalArgumentException here");
                } catch (IllegalArgumentException expected) {
                        // This Exception should be thrown, and thus the test should pass.