Jeff Genender wrote:
Hey guys,

I was hoping to see if we could discuss some of the "final" qualifiers
on some of the methods in the AbstractIOSession.  The reason I ask is it
would be cool to be able to override some of the methods such as:

public WriteFuture write(Object message)
public final int getScheduledWriteMessages()

To be able to write MockObjects for unit tests of code.  Any thoughts on
making these protected instead of final?

Thanks,

Jeff

Hi,

makes sense to me... Or we may have a AbstractMockIoSession implementing the IoSession interface, for unit tests ?

While looking at the abstract class, I found some methods with this kind of code :

public final WriteFuture write(Object message, SocketAddress remoteAddress) {
       if (message == null) {
           throw new NullPointerException("message");
       }
   ...

Wouldn't be a perfect case for an assert ? Like :

public final WriteFuture write(Object message, SocketAddress remoteAddress) {
       assert message != null : "Null messages are not allowed";
       ...

wdyt ?



--
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org


Reply via email to