/*
 * This file was automatically generated by EvoSuite
 * Tue Dec 10 01:49:56 GMT 2019
 */

package org.traccar.protocol;

import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.shaded.org.mockito.Mockito.*;
import static org.evosuite.runtime.EvoAssertions.*;
import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;
import java.text.ParseException;
import java.util.concurrent.ForkJoinPool;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.evosuite.runtime.Random;
import org.evosuite.runtime.System;
import org.evosuite.runtime.ViolatedAssumptionAnswer;
import org.evosuite.runtime.testdata.EvoSuiteFile;
import org.evosuite.runtime.testdata.FileSystemHandling;
import org.jboss.netty.buffer.BigEndianHeapChannelBuffer;
import org.jboss.netty.buffer.ByteBufferBackedChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.DynamicChannelBuffer;
import org.jboss.netty.buffer.LittleEndianHeapChannelBuffer;
import org.jboss.netty.buffer.ReadOnlyChannelBuffer;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelFactory;
import org.jboss.netty.channel.ChannelHandler;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.channel.ChannelSink;
import org.jboss.netty.channel.DefaultChannelPipeline;
import org.jboss.netty.channel.local.DefaultLocalClientChannelFactory;
import org.jboss.netty.channel.local.DefaultLocalServerChannelFactory;
import org.jboss.netty.channel.local.LocalChannel;
import org.jboss.netty.channel.local.LocalServerChannel;
import org.jboss.netty.channel.socket.nio.NioSocketChannel;
import org.jboss.netty.channel.socket.nio.NioWorker;
import org.jboss.netty.util.ThreadNameDeterminer;
import org.junit.runner.RunWith;
import org.traccar.protocol.Jt600FrameDecoder;

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

  @Test(timeout = 4000)
  public void test0()  throws Throwable  {
      Random.setNextRandom(40);
      System.setCurrentTimeMillis(255L);
      Jt600FrameDecoder jt600FrameDecoder0 = new Jt600FrameDecoder();
      DefaultChannelPipeline defaultChannelPipeline0 = new DefaultChannelPipeline();
      defaultChannelPipeline0.getContext("Ot8KnD(");
      DefaultLocalServerChannelFactory defaultLocalServerChannelFactory0 = new DefaultLocalServerChannelFactory();
      LocalServerChannel localServerChannel0 = defaultLocalServerChannelFactory0.newChannel(defaultChannelPipeline0);
      byte[] byteArray0 = new byte[10];
      byteArray0[0] = (byte)80;
      byteArray0[1] = (byte) (-27);
      byteArray0[2] = (byte)123;
      byteArray0[3] = (byte) (-27);
      byteArray0[4] = (byte)41;
      FileSystemHandling.shouldAllThrowIOExceptions();
      FileSystemHandling.setPermissions((EvoSuiteFile) null, false, true, true);
      byteArray0[5] = (byte)0;
      ByteBuffer byteBuffer0 = ByteBuffer.wrap(byteArray0);
      ByteBufferBackedChannelBuffer byteBufferBackedChannelBuffer0 = new ByteBufferBackedChannelBuffer(byteBuffer0);
      ChannelBuffer channelBuffer0 = byteBufferBackedChannelBuffer0.duplicate();
      ReadOnlyChannelBuffer readOnlyChannelBuffer0 = new ReadOnlyChannelBuffer(channelBuffer0);
      try { 
        jt600FrameDecoder0.decode((ChannelHandlerContext) null, localServerChannel0, readOnlyChannelBuffer0);
        fail("Expecting exception: ParseException");
      
      } catch(ParseException e) {
         //
         // no message in exception (getMessage() returned null)
         //
         verifyException("org.traccar.protocol.Jt600FrameDecoder", e);
      }
  }

  @Test(timeout = 4000)
  public void test1()  throws Throwable  {
      Random.setNextRandom(40);
      System.setCurrentTimeMillis(255L);
      Jt600FrameDecoder jt600FrameDecoder0 = new Jt600FrameDecoder();
      DefaultChannelPipeline defaultChannelPipeline0 = new DefaultChannelPipeline();
      defaultChannelPipeline0.getContext("Ot8KnD(");
      DefaultLocalServerChannelFactory defaultLocalServerChannelFactory0 = new DefaultLocalServerChannelFactory();
      LocalServerChannel localServerChannel0 = defaultLocalServerChannelFactory0.newChannel(defaultChannelPipeline0);
      byte[] byteArray0 = new byte[16];
      byte byte0 = (byte)80;
      byteArray0[0] = (byte)80;
      byteArray0[1] = (byte)8;
      byteArray0[2] = (byte)123;
      byteArray0[3] = (byte)0;
      byteArray0[4] = (byte)41;
      byteArray0[5] = (byte)0;
      ByteBuffer byteBuffer0 = ByteBuffer.wrap(byteArray0);
      ByteBufferBackedChannelBuffer byteBufferBackedChannelBuffer0 = new ByteBufferBackedChannelBuffer(byteBuffer0);
      ChannelBuffer channelBuffer0 = byteBufferBackedChannelBuffer0.duplicate();
      ReadOnlyChannelBuffer readOnlyChannelBuffer0 = new ReadOnlyChannelBuffer(channelBuffer0);
      try { 
        jt600FrameDecoder0.decode((ChannelHandlerContext) null, localServerChannel0, readOnlyChannelBuffer0);
        fail("Expecting exception: ParseException");
      
      } catch(ParseException e) {
         //
         // no message in exception (getMessage() returned null)
         //
         verifyException("org.traccar.protocol.Jt600FrameDecoder", e);
      }
  }

  @Test(timeout = 4000)
  public void test2()  throws Throwable  {
      Jt600FrameDecoder jt600FrameDecoder0 = new Jt600FrameDecoder();
      DefaultChannelPipeline defaultChannelPipeline0 = new DefaultChannelPipeline();
      Class<ChannelHandler> class0 = ChannelHandler.class;
      defaultChannelPipeline0.getContext(class0);
      defaultChannelPipeline0.getChannel();
      ChannelSink channelSink0 = defaultChannelPipeline0.getSink();
      SocketChannel socketChannel0 = SocketChannel.open();
      ForkJoinPool forkJoinPool0 = new ForkJoinPool();
      ThreadNameDeterminer threadNameDeterminer0 = mock(ThreadNameDeterminer.class, new ViolatedAssumptionAnswer());
      doReturn((String) null).when(threadNameDeterminer0).determineThreadName(anyString() , anyString());
      NioWorker nioWorker0 = new NioWorker(forkJoinPool0, threadNameDeterminer0);
      NioSocketChannel nioSocketChannel0 = new NioSocketChannel((Channel) null, (ChannelFactory) null, defaultChannelPipeline0, channelSink0, socketChannel0, nioWorker0);
      try { 
        jt600FrameDecoder0.decode((ChannelHandlerContext) null, nioSocketChannel0, (ChannelBuffer) null);
        fail("Expecting exception: NullPointerException");
      
      } catch(NullPointerException e) {
         //
         // no message in exception (getMessage() returned null)
         //
         verifyException("org.traccar.protocol.Jt600FrameDecoder", e);
      }
  }

  @Test(timeout = 4000)
  public void test3()  throws Throwable  {
      Jt600FrameDecoder jt600FrameDecoder0 = new Jt600FrameDecoder();
      DefaultChannelPipeline defaultChannelPipeline0 = new DefaultChannelPipeline();
      defaultChannelPipeline0.getContext((ChannelHandler) jt600FrameDecoder0);
      defaultChannelPipeline0.getChannel();
      LittleEndianHeapChannelBuffer littleEndianHeapChannelBuffer0 = new LittleEndianHeapChannelBuffer(1024);
      jt600FrameDecoder0.decode((ChannelHandlerContext) null, (Channel) null, littleEndianHeapChannelBuffer0);
      Object object0 = jt600FrameDecoder0.decode((ChannelHandlerContext) null, (Channel) null, littleEndianHeapChannelBuffer0);
      assertNull(object0);
  }

  @Test(timeout = 4000)
  public void test4()  throws Throwable  {
      Jt600FrameDecoder jt600FrameDecoder0 = new Jt600FrameDecoder();
      DefaultChannelPipeline defaultChannelPipeline0 = new DefaultChannelPipeline();
      Class<ChannelHandler> class0 = ChannelHandler.class;
      defaultChannelPipeline0.getContext(class0);
      DefaultLocalServerChannelFactory defaultLocalServerChannelFactory0 = new DefaultLocalServerChannelFactory();
      LocalServerChannel localServerChannel0 = defaultLocalServerChannelFactory0.newChannel(defaultChannelPipeline0);
      BigEndianHeapChannelBuffer bigEndianHeapChannelBuffer0 = new BigEndianHeapChannelBuffer(117);
      ChannelBuffer channelBuffer0 = bigEndianHeapChannelBuffer0.slice(0, 117);
      try { 
        jt600FrameDecoder0.decode((ChannelHandlerContext) null, localServerChannel0, channelBuffer0);
        fail("Expecting exception: ParseException");
      
      } catch(ParseException e) {
         //
         // no message in exception (getMessage() returned null)
         //
         verifyException("org.traccar.protocol.Jt600FrameDecoder", e);
      }
  }

  @Test(timeout = 4000)
  public void test5()  throws Throwable  {
      Jt600FrameDecoder jt600FrameDecoder0 = new Jt600FrameDecoder();
      DefaultChannelPipeline defaultChannelPipeline0 = new DefaultChannelPipeline();
      Class<ChannelHandler> class0 = ChannelHandler.class;
      defaultChannelPipeline0.getContext(class0);
      DefaultLocalClientChannelFactory defaultLocalClientChannelFactory0 = new DefaultLocalClientChannelFactory();
      LocalChannel localChannel0 = defaultLocalClientChannelFactory0.newChannel(defaultChannelPipeline0);
      DynamicChannelBuffer dynamicChannelBuffer0 = new DynamicChannelBuffer(1024);
      jt600FrameDecoder0.decode((ChannelHandlerContext) null, localChannel0, dynamicChannelBuffer0);
      jt600FrameDecoder0.decode((ChannelHandlerContext) null, localChannel0, dynamicChannelBuffer0);
      assertEquals(0, (int)localChannel0.getId());
  }

  @Test(timeout = 4000)
  public void test6()  throws Throwable  {
      Jt600FrameDecoder jt600FrameDecoder0 = new Jt600FrameDecoder();
      DefaultChannelPipeline defaultChannelPipeline0 = new DefaultChannelPipeline();
      defaultChannelPipeline0.getContext("C\tlg^6V`R");
      defaultChannelPipeline0.getChannel();
      ByteBuffer byteBuffer0 = ByteBuffer.allocate(1024);
      ByteBufferBackedChannelBuffer byteBufferBackedChannelBuffer0 = new ByteBufferBackedChannelBuffer(byteBuffer0);
      try { 
        jt600FrameDecoder0.decode((ChannelHandlerContext) null, (Channel) null, byteBufferBackedChannelBuffer0);
        fail("Expecting exception: ParseException");
      
      } catch(ParseException e) {
         //
         // no message in exception (getMessage() returned null)
         //
         verifyException("org.traccar.protocol.Jt600FrameDecoder", e);
      }
  }

  @Test(timeout = 4000)
  public void test7()  throws Throwable  {
      DefaultChannelPipeline defaultChannelPipeline0 = new DefaultChannelPipeline();
      Channel channel0 = defaultChannelPipeline0.getChannel();
      assertNull(channel0);
  }
}
