Merge redundant tests together

Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/7abba05a
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/7abba05a
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/7abba05a

Branch: refs/heads/5.4-js-rewrite
Commit: 7abba05a441acf8f06186dcf95e58dfd7161f003
Parents: b76b21c
Author: Howard M. Lewis Ship <[email protected]>
Authored: Tue Nov 20 10:15:42 2012 -0800
Committer: Howard M. Lewis Ship <[email protected]>
Committed: Tue Nov 20 10:15:42 2012 -0800

----------------------------------------------------------------------
 .../services/ClientDataEncoderImplTest.groovy      |   25 ++++
 .../internal/services/ClientDataEncoderTest.java   |   99 ---------------
 2 files changed, 25 insertions(+), 99 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/7abba05a/tapestry-core/src/test/groovy/org/apache/tapestry5/internal/services/ClientDataEncoderImplTest.groovy
----------------------------------------------------------------------
diff --git 
a/tapestry-core/src/test/groovy/org/apache/tapestry5/internal/services/ClientDataEncoderImplTest.groovy
 
b/tapestry-core/src/test/groovy/org/apache/tapestry5/internal/services/ClientDataEncoderImplTest.groovy
index 68e1ab7..c2f3948 100644
--- 
a/tapestry-core/src/test/groovy/org/apache/tapestry5/internal/services/ClientDataEncoderImplTest.groovy
+++ 
b/tapestry-core/src/test/groovy/org/apache/tapestry5/internal/services/ClientDataEncoderImplTest.groovy
@@ -108,4 +108,29 @@ class ClientDataEncoderImplTest extends TestBase {
         }
     }
 
+    @Test(expectedExceptions = EOFException)
+    void check_for_eof() {
+        ClientDataEncoder cde = new ClientDataEncoderImpl(null, "hmac 
passphrase", null, "foo.bar", null)
+
+        def sink = cde.createSink()
+
+        def os = sink.objectOutputStream
+
+        def names = ["fred", "barney", "wilma"]
+
+        names.each { os.writeObject it }
+
+        os.close()
+
+        def ois = cde.decodeClientData(sink.clientData)
+
+        names.each { assert (ois.readObject() == it )}
+
+        // This should fail:
+
+        ois.readObject()
+
+        unreachable()
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/7abba05a/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ClientDataEncoderTest.java
----------------------------------------------------------------------
diff --git 
a/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ClientDataEncoderTest.java
 
b/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ClientDataEncoderTest.java
deleted file mode 100644
index ac3ff49..0000000
--- 
a/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ClientDataEncoderTest.java
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright 2006, 2009 The Apache Software Foundation
-//
-// 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 org.apache.tapestry5.internal.services;
-
-import org.apache.tapestry5.internal.test.InternalBaseTestCase;
-import org.apache.tapestry5.ioc.internal.util.CollectionFactory;
-import org.apache.tapestry5.services.ClientDataEncoder;
-import org.apache.tapestry5.services.ClientDataSink;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import java.io.EOFException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.util.Map;
-
-public class ClientDataEncoderTest extends InternalBaseTestCase
-{
-    private ClientDataEncoder encoder;
-
-    @BeforeClass
-    public void setup()
-    {
-        encoder = getService(ClientDataEncoder.class);
-    }
-
-
-    @SuppressWarnings("unchecked")
-    @Test
-    public void round_trip_is_equal() throws Exception
-    {
-        Map input = CollectionFactory.newMap();
-
-        input.put("fred", "flintstone");
-        input.put("barney", "rubble");
-
-        ClientDataSink sink = encoder.createSink();
-
-        sink.getObjectOutputStream().writeObject(input);
-
-        String clientData = sink.getClientData();
-
-        ObjectInputStream ois = encoder.decodeClientData(clientData);
-
-        Map output = (Map) ois.readObject();
-
-        assertEquals(output, input);
-        assertNotSame(output, input);
-    }
-
-    @Test
-    public void checks_for_eof() throws Exception
-    {
-        String[] values = { "fred", "barney", "wilma" };
-
-        ClientDataSink sink = encoder.createSink();
-
-        ObjectOutputStream os = sink.getObjectOutputStream();
-
-        for (String value : values)
-            os.writeObject(value);
-
-        os.close();
-
-        String clientData = sink.getClientData();
-
-        ObjectInputStream ois = encoder.decodeClientData(clientData);
-
-        for (int i = 0; i < 3; i++)
-        {
-            String value = (String) ois.readObject();
-
-            assertEquals(value, values[i]);
-        }
-
-        try
-        {
-            ois.readObject();
-            fail("Unreachable.");
-        }
-        catch (EOFException ex)
-        {
-            // Expected.
-        }
-
-    }
-}

Reply via email to