You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by el...@apache.org on 2013/04/10 12:11:01 UTC

[2/5] git commit: Fixed teh tests accordingly to the modification made on the decode() metod, which returns null when the ByteBuffer is empty.

Fixed teh tests accordingly to the modification made on the decode()
metod, which returns null when the ByteBuffer is empty.

Project: http://git-wip-us.apache.org/repos/asf/mina/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina/commit/62738729
Tree: http://git-wip-us.apache.org/repos/asf/mina/tree/62738729
Diff: http://git-wip-us.apache.org/repos/asf/mina/diff/62738729

Branch: refs/heads/trunk
Commit: 627387292fad3f1ec56ba60fc89b90ce0ddf4d49
Parents: f274585
Author: Emmanuel Lécharny <el...@apache.org>
Authored: Wed Apr 10 11:51:09 2013 +0200
Committer: Emmanuel Lécharny <el...@apache.org>
Committed: Wed Apr 10 11:51:09 2013 +0200

----------------------------------------------------------------------
 .../codec/textline/AutoTextLineDecoderTest.java    |   18 +++++++-------
 .../codec/textline/UnixTextLineDecoderTest.java    |   18 +++++++-------
 .../codec/textline/WindowsTextLineDecoderTest.java |   18 +++++++-------
 3 files changed, 27 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina/blob/62738729/codec/src/test/java/org/apache/mina/codec/textline/AutoTextLineDecoderTest.java
----------------------------------------------------------------------
diff --git a/codec/src/test/java/org/apache/mina/codec/textline/AutoTextLineDecoderTest.java b/codec/src/test/java/org/apache/mina/codec/textline/AutoTextLineDecoderTest.java
index ca087c4..a08c65b 100644
--- a/codec/src/test/java/org/apache/mina/codec/textline/AutoTextLineDecoderTest.java
+++ b/codec/src/test/java/org/apache/mina/codec/textline/AutoTextLineDecoderTest.java
@@ -21,6 +21,7 @@ package org.apache.mina.codec.textline;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
 
 import java.nio.ByteBuffer;
 
@@ -39,10 +40,9 @@ public class AutoTextLineDecoderTest {
         TextLineDecoder decoder = new TextLineDecoder();
         Context context = decoder.createDecoderState();
         String[] results = decoder.decode(ByteBuffer.allocate(0), context);
-        assertNotNull(results);
-        assertEquals(0, results.length);
+        assertNull(results);
     }
-    
+
     @Test
     public void testThatNonLineTerminatedStringReturnsEmptyResult() {
         TextLineDecoder decoder = new TextLineDecoder();
@@ -52,7 +52,7 @@ public class AutoTextLineDecoderTest {
         assertEquals(0, results.length);
         assertEquals(8, context.getBuffer().position());
     }
-    
+
     @Test
     public void testThatUnixLineTerminatedStringReturnsNonEmptyResult() {
         TextLineDecoder decoder = new TextLineDecoder();
@@ -63,7 +63,7 @@ public class AutoTextLineDecoderTest {
         assertEquals("a string", results[0]);
         assertEquals(0, context.getBuffer().position());
     }
-    
+
     @Test
     public void testThatWindowsLineTerminatedStringReturnsNonEmptyResult() {
         TextLineDecoder decoder = new TextLineDecoder();
@@ -74,7 +74,7 @@ public class AutoTextLineDecoderTest {
         assertEquals("a string", results[0]);
         assertEquals(0, context.getBuffer().position());
     }
-    
+
     @Test
     public void testThatContextIsMaintainedBetweenMessages() {
         TextLineDecoder decoder = new TextLineDecoder();
@@ -96,7 +96,7 @@ public class AutoTextLineDecoderTest {
         TextLineDecoder decoder = new TextLineDecoder();
         Context context = decoder.createDecoderState();
         StringBuffer sb = new StringBuffer();
-        for(int i=0; i < 100;++i) {
+        for (int i = 0; i < 100; ++i) {
             sb.append("a string");
         }
         String[] results = decoder.decode(ByteBuffer.wrap((sb.toString() + "\n").getBytes()), context);
@@ -105,13 +105,13 @@ public class AutoTextLineDecoderTest {
         assertEquals(sb.toString(), results[0]);
         assertEquals(0, context.getBuffer().position());
     }
-    
+
     @Test
     public void testThatWindowsLineTerminatedLongStringReturnsNonEmptyResult() {
         TextLineDecoder decoder = new TextLineDecoder();
         Context context = decoder.createDecoderState();
         StringBuffer sb = new StringBuffer();
-        for(int i=0; i < 100;++i) {
+        for (int i = 0; i < 100; ++i) {
             sb.append("a string");
         }
         String[] results = decoder.decode(ByteBuffer.wrap((sb.toString() + "\r\n").getBytes()), context);

http://git-wip-us.apache.org/repos/asf/mina/blob/62738729/codec/src/test/java/org/apache/mina/codec/textline/UnixTextLineDecoderTest.java
----------------------------------------------------------------------
diff --git a/codec/src/test/java/org/apache/mina/codec/textline/UnixTextLineDecoderTest.java b/codec/src/test/java/org/apache/mina/codec/textline/UnixTextLineDecoderTest.java
index 2023187..7d2eab5 100644
--- a/codec/src/test/java/org/apache/mina/codec/textline/UnixTextLineDecoderTest.java
+++ b/codec/src/test/java/org/apache/mina/codec/textline/UnixTextLineDecoderTest.java
@@ -21,6 +21,7 @@ package org.apache.mina.codec.textline;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
 
 import java.nio.ByteBuffer;
 
@@ -39,10 +40,9 @@ public class UnixTextLineDecoderTest {
         TextLineDecoder decoder = new TextLineDecoder(LineDelimiter.UNIX);
         Context context = decoder.createDecoderState();
         String[] results = decoder.decode(ByteBuffer.allocate(0), context);
-        assertNotNull(results);
-        assertEquals(0, results.length);
+        assertNull(results);
     }
-    
+
     @Test
     public void testThatNonLineTerminatedStringReturnsEmptyResult() {
         TextLineDecoder decoder = new TextLineDecoder(LineDelimiter.UNIX);
@@ -52,7 +52,7 @@ public class UnixTextLineDecoderTest {
         assertEquals(0, results.length);
         assertEquals(8, context.getBuffer().position());
     }
-    
+
     @Test
     public void testThatUnixLineTerminatedStringReturnsNonEmptyResult() {
         TextLineDecoder decoder = new TextLineDecoder(LineDelimiter.UNIX);
@@ -63,7 +63,7 @@ public class UnixTextLineDecoderTest {
         assertEquals("a string", results[0]);
         assertEquals(0, context.getBuffer().position());
     }
-    
+
     @Test
     public void testThatWindowsLineTerminatedStringReturnsNonEmptyResult() {
         TextLineDecoder decoder = new TextLineDecoder(LineDelimiter.UNIX);
@@ -74,7 +74,7 @@ public class UnixTextLineDecoderTest {
         assertEquals("a string\r", results[0]);
         assertEquals(0, context.getBuffer().position());
     }
-    
+
     @Test
     public void testThatContextIsMaintainedBetweenMessages() {
         TextLineDecoder decoder = new TextLineDecoder(LineDelimiter.UNIX);
@@ -96,7 +96,7 @@ public class UnixTextLineDecoderTest {
         TextLineDecoder decoder = new TextLineDecoder(LineDelimiter.UNIX);
         Context context = decoder.createDecoderState();
         StringBuffer sb = new StringBuffer();
-        for(int i=0; i < 100;++i) {
+        for (int i = 0; i < 100; ++i) {
             sb.append("a string");
         }
         String[] results = decoder.decode(ByteBuffer.wrap((sb.toString() + "\n").getBytes()), context);
@@ -105,13 +105,13 @@ public class UnixTextLineDecoderTest {
         assertEquals(sb.toString(), results[0]);
         assertEquals(0, context.getBuffer().position());
     }
-    
+
     @Test
     public void testThatWindowsLineTerminatedLongStringReturnsNonEmptyResult() {
         TextLineDecoder decoder = new TextLineDecoder(LineDelimiter.UNIX);
         Context context = decoder.createDecoderState();
         StringBuffer sb = new StringBuffer();
-        for(int i=0; i < 100;++i) {
+        for (int i = 0; i < 100; ++i) {
             sb.append("a string");
         }
         String[] results = decoder.decode(ByteBuffer.wrap((sb.toString() + "\r\n").getBytes()), context);

http://git-wip-us.apache.org/repos/asf/mina/blob/62738729/codec/src/test/java/org/apache/mina/codec/textline/WindowsTextLineDecoderTest.java
----------------------------------------------------------------------
diff --git a/codec/src/test/java/org/apache/mina/codec/textline/WindowsTextLineDecoderTest.java b/codec/src/test/java/org/apache/mina/codec/textline/WindowsTextLineDecoderTest.java
index 727fd17..add2cc6 100644
--- a/codec/src/test/java/org/apache/mina/codec/textline/WindowsTextLineDecoderTest.java
+++ b/codec/src/test/java/org/apache/mina/codec/textline/WindowsTextLineDecoderTest.java
@@ -21,6 +21,7 @@ package org.apache.mina.codec.textline;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
 
 import java.nio.ByteBuffer;
 
@@ -39,10 +40,9 @@ public class WindowsTextLineDecoderTest {
         TextLineDecoder decoder = new TextLineDecoder(LineDelimiter.WINDOWS);
         Context context = decoder.createDecoderState();
         String[] results = decoder.decode(ByteBuffer.allocate(0), context);
-        assertNotNull(results);
-        assertEquals(0, results.length);
+        assertNull(results);
     }
-    
+
     @Test
     public void testThatNonLineTerminatedStringReturnsEmptyResult() {
         TextLineDecoder decoder = new TextLineDecoder(LineDelimiter.WINDOWS);
@@ -52,7 +52,7 @@ public class WindowsTextLineDecoderTest {
         assertEquals(0, results.length);
         assertEquals(8, context.getBuffer().position());
     }
-    
+
     @Test
     public void testThatUnixLineTerminatedStringReturnsEmptyResult() {
         TextLineDecoder decoder = new TextLineDecoder(LineDelimiter.WINDOWS);
@@ -62,7 +62,7 @@ public class WindowsTextLineDecoderTest {
         assertEquals(0, results.length);
         assertEquals(9, context.getBuffer().position());
     }
-    
+
     @Test
     public void testThatWindowsLineTerminatedStringReturnsNonEmptyResult() {
         TextLineDecoder decoder = new TextLineDecoder(LineDelimiter.WINDOWS);
@@ -73,7 +73,7 @@ public class WindowsTextLineDecoderTest {
         assertEquals("a string", results[0]);
         assertEquals(0, context.getBuffer().position());
     }
-    
+
     @Test
     public void testThatContextIsMaintainedBetweenMessages() {
         TextLineDecoder decoder = new TextLineDecoder(LineDelimiter.WINDOWS);
@@ -95,7 +95,7 @@ public class WindowsTextLineDecoderTest {
         TextLineDecoder decoder = new TextLineDecoder(LineDelimiter.WINDOWS);
         Context context = decoder.createDecoderState();
         StringBuffer sb = new StringBuffer();
-        for(int i=0; i < 100;++i) {
+        for (int i = 0; i < 100; ++i) {
             sb.append("a string");
         }
         String[] results = decoder.decode(ByteBuffer.wrap((sb.toString() + "\n").getBytes()), context);
@@ -103,13 +103,13 @@ public class WindowsTextLineDecoderTest {
         assertEquals(0, results.length);
         assertEquals(801, context.getBuffer().position());
     }
-    
+
     @Test
     public void testThatWindowsLineTerminatedLongStringReturnsNonEmptyResult() {
         TextLineDecoder decoder = new TextLineDecoder(LineDelimiter.WINDOWS);
         Context context = decoder.createDecoderState();
         StringBuffer sb = new StringBuffer();
-        for(int i=0; i < 100;++i) {
+        for (int i = 0; i < 100; ++i) {
             sb.append("a string");
         }
         String[] results = decoder.decode(ByteBuffer.wrap((sb.toString() + "\r\n").getBytes()), context);