/*
 * This file was automatically generated by EvoSuite
 * Mon Dec 09 23:06:33 GMT 2019
 */

package org.traccar.protocol;

import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.runtime.EvoAssertions.*;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.nio.ByteOrder;
import java.util.LinkedList;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.evosuite.runtime.mock.java.net.MockInetAddress;
import org.evosuite.runtime.mock.java.net.MockInetSocketAddress;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.CompositeChannelBuffer;
import org.jboss.netty.buffer.LittleEndianHeapChannelBuffer;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.DefaultChannelPipeline;
import org.jboss.netty.channel.local.DefaultLocalClientChannelFactory;
import org.jboss.netty.channel.local.LocalChannel;
import org.junit.runner.RunWith;
import org.traccar.protocol.EelinkProtocol;
import org.traccar.protocol.EelinkProtocolDecoder;

@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true, useJEE = true) 
public class EelinkProtocolDecoder_ESTest extends EelinkProtocolDecoder_ESTest_scaffolding {

  @Test(timeout = 4000)
  public void test0()  throws Throwable  {
      EelinkProtocol eelinkProtocol0 = new EelinkProtocol();
      EelinkProtocolDecoder eelinkProtocolDecoder0 = new EelinkProtocolDecoder(eelinkProtocol0);
      DefaultLocalClientChannelFactory defaultLocalClientChannelFactory0 = new DefaultLocalClientChannelFactory();
      DefaultChannelPipeline defaultChannelPipeline0 = new DefaultChannelPipeline();
      LocalChannel localChannel0 = defaultLocalClientChannelFactory0.newChannel(defaultChannelPipeline0);
      InetSocketAddress inetSocketAddress0 = MockInetSocketAddress.createUnresolved("", 4);
      byte[] byteArray0 = new byte[9];
      byteArray0[2] = (byte)94;
      LittleEndianHeapChannelBuffer littleEndianHeapChannelBuffer0 = new LittleEndianHeapChannelBuffer(byteArray0);
      try { 
        eelinkProtocolDecoder0.decode(localChannel0, inetSocketAddress0, littleEndianHeapChannelBuffer0);
        fail("Expecting exception: NullPointerException");
      
      } catch(NullPointerException e) {
         //
         // no message in exception (getMessage() returned null)
         //
         verifyException("org.traccar.BaseProtocolDecoder", e);
      }
  }

  @Test(timeout = 4000)
  public void test1()  throws Throwable  {
      EelinkProtocol eelinkProtocol0 = new EelinkProtocol();
      EelinkProtocolDecoder eelinkProtocolDecoder0 = new EelinkProtocolDecoder(eelinkProtocol0);
      InetAddress inetAddress0 = MockInetAddress.getLoopbackAddress();
      MockInetSocketAddress mockInetSocketAddress0 = new MockInetSocketAddress(inetAddress0, 0);
      LinkedList<ChannelBuffer> linkedList0 = new LinkedList<ChannelBuffer>();
      CompositeChannelBuffer compositeChannelBuffer0 = new CompositeChannelBuffer((ByteOrder) null, linkedList0, true);
      try { 
        eelinkProtocolDecoder0.decode((Channel) null, mockInetSocketAddress0, compositeChannelBuffer0);
        fail("Expecting exception: IndexOutOfBoundsException");
      
      } catch(IndexOutOfBoundsException e) {
         //
         // Readable bytes exceeded - Need 2, maximum is 0
         //
         verifyException("org.jboss.netty.buffer.AbstractChannelBuffer", e);
      }
  }

  @Test(timeout = 4000)
  public void test2()  throws Throwable  {
      EelinkProtocol eelinkProtocol0 = new EelinkProtocol();
      EelinkProtocolDecoder eelinkProtocolDecoder0 = new EelinkProtocolDecoder(eelinkProtocol0);
      InetSocketAddress inetSocketAddress0 = MockInetSocketAddress.createUnresolved("battery", 0);
      try { 
        eelinkProtocolDecoder0.decode((Channel) null, inetSocketAddress0, "battery");
        fail("Expecting exception: ClassCastException");
      
      } catch(ClassCastException e) {
         //
         // java.lang.String cannot be cast to org.jboss.netty.buffer.ChannelBuffer
         //
         verifyException("org.traccar.protocol.EelinkProtocolDecoder", e);
      }
  }

  @Test(timeout = 4000)
  public void test3()  throws Throwable  {
      EelinkProtocol eelinkProtocol0 = new EelinkProtocol();
      EelinkProtocolDecoder eelinkProtocolDecoder0 = new EelinkProtocolDecoder(eelinkProtocol0);
      DefaultLocalClientChannelFactory defaultLocalClientChannelFactory0 = new DefaultLocalClientChannelFactory();
      DefaultChannelPipeline defaultChannelPipeline0 = new DefaultChannelPipeline();
      LocalChannel localChannel0 = defaultLocalClientChannelFactory0.newChannel(defaultChannelPipeline0);
      InetSocketAddress inetSocketAddress0 = MockInetSocketAddress.createUnresolved("", 4);
      byte[] byteArray0 = new byte[9];
      LittleEndianHeapChannelBuffer littleEndianHeapChannelBuffer0 = new LittleEndianHeapChannelBuffer(byteArray0);
      try { 
        eelinkProtocolDecoder0.decode(localChannel0, inetSocketAddress0, littleEndianHeapChannelBuffer0);
        fail("Expecting exception: NullPointerException");
      
      } catch(NullPointerException e) {
         //
         // no message in exception (getMessage() returned null)
         //
         verifyException("org.traccar.BaseProtocolDecoder", e);
      }
  }
}
