Suppressed more warnings

This commit is contained in:
Trustin Lee 2008-09-06 09:34:40 +00:00
parent beb0fb0d6f
commit d39fd30f09
2 changed files with 21 additions and 15 deletions

View File

@ -32,11 +32,11 @@ import java.util.Map;
import java.util.NoSuchElementException; import java.util.NoSuchElementException;
import java.util.Map.Entry; import java.util.Map.Entry;
import org.jboss.netty.channel.ChannelDownstreamHandler;
import org.jboss.netty.channel.ChannelFactory; import org.jboss.netty.channel.ChannelFactory;
import org.jboss.netty.channel.ChannelHandler; import org.jboss.netty.channel.ChannelHandler;
import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.channel.ChannelPipeline;
import org.jboss.netty.channel.ChannelPipelineFactory; import org.jboss.netty.channel.ChannelPipelineFactory;
import org.jboss.netty.util.DummyHandler;
import org.junit.Test; import org.junit.Test;
@ -134,10 +134,10 @@ public class BootstrapTest {
public void shouldReturnOrderedPipelineMap() { public void shouldReturnOrderedPipelineMap() {
Bootstrap b = new Bootstrap(); Bootstrap b = new Bootstrap();
ChannelPipeline p = b.getPipeline(); ChannelPipeline p = b.getPipeline();
p.addLast("a", createMock(ChannelDownstreamHandler.class)); p.addLast("a", new DummyHandler());
p.addLast("b", createMock(ChannelDownstreamHandler.class)); p.addLast("b", new DummyHandler());
p.addLast("c", createMock(ChannelDownstreamHandler.class)); p.addLast("c", new DummyHandler());
p.addLast("d", createMock(ChannelDownstreamHandler.class)); p.addLast("d", new DummyHandler());
Iterator<Entry<String, ChannelHandler>> m = Iterator<Entry<String, ChannelHandler>> m =
b.getPipelineAsMap().entrySet().iterator(); b.getPipelineAsMap().entrySet().iterator();
@ -161,10 +161,10 @@ public class BootstrapTest {
@Test(expected = IllegalArgumentException.class) @Test(expected = IllegalArgumentException.class)
public void shouldNotAllowUnorderedPipelineMap() { public void shouldNotAllowUnorderedPipelineMap() {
Map<String, ChannelHandler> m = new HashMap<String, ChannelHandler>(); Map<String, ChannelHandler> m = new HashMap<String, ChannelHandler>();
m.put("a", createMock(ChannelDownstreamHandler.class)); m.put("a", new DummyHandler());
m.put("b", createMock(ChannelDownstreamHandler.class)); m.put("b", new DummyHandler());
m.put("c", createMock(ChannelDownstreamHandler.class)); m.put("c", new DummyHandler());
m.put("d", createMock(ChannelDownstreamHandler.class)); m.put("d", new DummyHandler());
Bootstrap b = new Bootstrap(); Bootstrap b = new Bootstrap();
b.setPipelineAsMap(m); b.setPipelineAsMap(m);
@ -173,10 +173,10 @@ public class BootstrapTest {
@Test @Test
public void shouldHaveOrderedPipelineWhenSetFromMap() { public void shouldHaveOrderedPipelineWhenSetFromMap() {
Map<String, ChannelHandler> m = new LinkedHashMap<String, ChannelHandler>(); Map<String, ChannelHandler> m = new LinkedHashMap<String, ChannelHandler>();
m.put("a", createMock(ChannelDownstreamHandler.class)); m.put("a", new DummyHandler());
m.put("b", createMock(ChannelDownstreamHandler.class)); m.put("b", new DummyHandler());
m.put("c", createMock(ChannelDownstreamHandler.class)); m.put("c", new DummyHandler());
m.put("d", createMock(ChannelDownstreamHandler.class)); m.put("d", new DummyHandler());
Bootstrap b = new Bootstrap(); Bootstrap b = new Bootstrap();
b.setPipelineAsMap(m); b.setPipelineAsMap(m);

View File

@ -1,5 +1,6 @@
package org.jboss.netty.util; package org.jboss.netty.util;
import org.jboss.netty.channel.ChannelDownstreamHandler;
import org.jboss.netty.channel.ChannelEvent; import org.jboss.netty.channel.ChannelEvent;
import org.jboss.netty.channel.ChannelHandlerContext; import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.channel.ChannelPipelineCoverage; import org.jboss.netty.channel.ChannelPipelineCoverage;
@ -14,10 +15,15 @@ import org.jboss.netty.channel.ChannelUpstreamHandler;
* @version $Rev$, $Date$ * @version $Rev$, $Date$
*/ */
@ChannelPipelineCoverage("all") @ChannelPipelineCoverage("all")
public class DummyHandler implements ChannelUpstreamHandler { public class DummyHandler implements ChannelUpstreamHandler, ChannelDownstreamHandler {
public void handleUpstream(ChannelHandlerContext ctx, ChannelEvent e) public void handleUpstream(ChannelHandlerContext ctx, ChannelEvent e)
throws Exception { throws Exception {
// Do nothing. ctx.sendUpstream(e);
}
public void handleDownstream(ChannelHandlerContext ctx, ChannelEvent e)
throws Exception {
ctx.sendDownstream(e);
} }
} }