package com.tacitknowledge.slowlight.proxyserver.handler;

import org.junit.Before;
import org.junit.Test;

import java.util.Objects;

import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;

/**
 * @author Alexandr Donciu (adonciu@tacitknowledge.com)
 */
public class DiscardChannelHandlerTest extends BaseChannelHandlerTest
{
    private DiscardChannelHandler discardChannelHandler;

    @Before
    public void setup()
    {
        super.setup();

        discardChannelHandler = new DiscardChannelHandler(handlerConfig);
    }

    @Test
    public void handlerShouldEnableReadOnChannelActivation() throws Exception
    {
        discardChannelHandler.channelActive(channelHandlerContext);

        verify(channelHandlerContext).fireChannelActive();
    }

    @Test
    public void handlerShouldDiscardDataAndEnableNextRead() throws Exception
    {
        discardChannelHandler.channelRead(channelHandlerContext, msg);

        verify(channelHandlerContext).read();
        verifyNoMoreInteractions(channelHandlerContext);
    }
}

@@ -105,35 +105,8 @@
 t;%0A%0A
-import java.util.Objects;%0A%0A
 impo

remove un-used import