Fix test failures due to recent changes with codec exceptions

This commit is contained in:
Trustin Lee 2012-05-18 15:45:12 +09:00
parent 2802b231e5
commit 5c3b432f60
4 changed files with 14 additions and 18 deletions

View File

@ -18,7 +18,7 @@ package io.netty.handler.codec.bytes;
import static io.netty.buffer.ChannelBuffers.*;
import static org.hamcrest.core.Is.*;
import static org.junit.Assert.*;
import io.netty.handler.codec.embedder.CodecEmbedderException;
import io.netty.handler.codec.DecoderException;
import io.netty.handler.codec.embedder.DecoderEmbedder;
import java.util.Random;
@ -59,7 +59,7 @@ public class ByteArrayDecoderTest {
try {
embedder.poll();
fail();
} catch (CodecEmbedderException e) {
} catch (DecoderException e) {
// Expected
assertTrue(e.getCause() instanceof ClassCastException);
}

View File

@ -20,7 +20,7 @@ import static org.hamcrest.core.Is.*;
import static org.hamcrest.core.IsNull.*;
import static org.junit.Assert.*;
import io.netty.buffer.ChannelBuffer;
import io.netty.handler.codec.embedder.CodecEmbedderException;
import io.netty.handler.codec.EncoderException;
import io.netty.handler.codec.embedder.EncoderEmbedder;
import java.util.Random;
@ -61,7 +61,7 @@ public class ByteArrayEncoderTest {
try {
embedder.poll();
fail();
} catch (CodecEmbedderException e) {
} catch (EncoderException e) {
// Expected
assertTrue(e.getCause() instanceof ClassCastException);
}

View File

@ -18,10 +18,10 @@ package io.netty.handler.codec.frame;
import static org.junit.Assert.*;
import io.netty.buffer.ChannelBuffer;
import io.netty.buffer.ChannelBuffers;
import io.netty.handler.codec.DecoderException;
import io.netty.handler.codec.DelimiterBasedFrameDecoder;
import io.netty.handler.codec.Delimiters;
import io.netty.handler.codec.TooLongFrameException;
import io.netty.handler.codec.embedder.CodecEmbedderException;
import io.netty.handler.codec.embedder.DecoderEmbedder;
import io.netty.util.CharsetUtil;
@ -39,9 +39,8 @@ public class DelimiterBasedFrameDecoderTest {
try {
assertTrue(embedder.offer(ChannelBuffers.wrappedBuffer(new byte[] { 0 })));
embedder.poll();
Assert.fail(CodecEmbedderException.class.getSimpleName() + " must be raised.");
} catch (CodecEmbedderException e) {
Assert.assertTrue(e.getCause() instanceof TooLongFrameException);
Assert.fail(DecoderException.class.getSimpleName() + " must be raised.");
} catch (TooLongFrameException e) {
// Expected
}
@ -60,9 +59,8 @@ public class DelimiterBasedFrameDecoderTest {
try {
assertTrue(embedder.offer(ChannelBuffers.wrappedBuffer(new byte[] { 1, 2 })));
embedder.poll();
Assert.fail(CodecEmbedderException.class.getSimpleName() + " must be raised.");
} catch (CodecEmbedderException e) {
Assert.assertTrue(e.getCause() instanceof TooLongFrameException);
Assert.fail(DecoderException.class.getSimpleName() + " must be raised.");
} catch (TooLongFrameException e) {
// Expected
}

View File

@ -18,9 +18,9 @@ package io.netty.handler.codec.frame;
import static org.junit.Assert.*;
import io.netty.buffer.ChannelBuffer;
import io.netty.buffer.ChannelBuffers;
import io.netty.handler.codec.DecoderException;
import io.netty.handler.codec.LengthFieldBasedFrameDecoder;
import io.netty.handler.codec.TooLongFrameException;
import io.netty.handler.codec.embedder.CodecEmbedderException;
import io.netty.handler.codec.embedder.DecoderEmbedder;
import io.netty.util.CharsetUtil;
@ -38,9 +38,8 @@ public class LengthFieldBasedFrameDecoderTest {
try {
assertTrue(embedder.offer(ChannelBuffers.wrappedBuffer(new byte[] { 0, 0 })));
embedder.poll();
Assert.fail(CodecEmbedderException.class.getSimpleName() + " must be raised.");
} catch (CodecEmbedderException e) {
Assert.assertTrue(e.getCause() instanceof TooLongFrameException);
Assert.fail(DecoderException.class.getSimpleName() + " must be raised.");
} catch (TooLongFrameException e) {
// Expected
}
@ -59,9 +58,8 @@ public class LengthFieldBasedFrameDecoderTest {
try {
assertTrue(embedder.offer(ChannelBuffers.wrappedBuffer(new byte[] { 0, 0, 0, 2 })));
embedder.poll();
Assert.fail(CodecEmbedderException.class.getSimpleName() + " must be raised.");
} catch (CodecEmbedderException e) {
Assert.assertTrue(e.getCause() instanceof TooLongFrameException);
Assert.fail(DecoderException.class.getSimpleName() + " must be raised.");
} catch (TooLongFrameException e) {
// Expected
}