It's my first time on testing (yes, i've never run a test before, but it's never to late to get started, isn't it?)
I'd a parser that parses a buffer, and dispatch an event).
Calling the parser:
parser.parse((ByteBuffer) readBuffer.duplicate().flip(), key);
parse method:
@Override
public void parse(final ByteBuffer buffer, final SelectionKey key) {
//Parse some stuff here and then dispatch a new event
eventDispatcher.dispatch(new ConnectionDataReadyArgs(key, host.toString(), port));
}
event handler:
@Override
public void handle(final ConnectionDataReadyArgs args) {
//Do stuff here with the recieved args
}
How do I create a junit test that checks if the arguments received on the event handler are right?
Thanks in advance.