/*
 * This file was automatically generated by EvoSuite
 * Mon Dec 09 22:45:52 GMT 2019
 */

package org.traccar.protocol;

import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.runtime.EvoAssertions.*;
import java.nio.ByteOrder;
import java.text.ParseException;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.DuplicatedChannelBuffer;
import org.jboss.netty.buffer.HeapChannelBufferFactory;
import org.jboss.netty.buffer.LittleEndianHeapChannelBuffer;
import org.jboss.netty.buffer.TruncatedChannelBuffer;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandler;
import org.jboss.netty.channel.ChannelHandlerContext;
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.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  {
      Jt600FrameDecoder jt600FrameDecoder0 = new Jt600FrameDecoder();
      DefaultChannelPipeline defaultChannelPipeline0 = new DefaultChannelPipeline();
      DefaultLocalClientChannelFactory defaultLocalClientChannelFactory0 = new DefaultLocalClientChannelFactory();
      LocalChannel localChannel0 = defaultLocalClientChannelFactory0.newChannel(defaultChannelPipeline0);
      HeapChannelBufferFactory heapChannelBufferFactory0 = new HeapChannelBufferFactory();
      ByteOrder byteOrder0 = ByteOrder.LITTLE_ENDIAN;
      ChannelBuffer channelBuffer0 = heapChannelBufferFactory0.getBuffer(byteOrder0, 1024);
      channelBuffer0.writeInt(53);
      TruncatedChannelBuffer truncatedChannelBuffer0 = new TruncatedChannelBuffer(channelBuffer0, 125);
      try { 
        jt600FrameDecoder0.decode((ChannelHandlerContext) null, localChannel0, truncatedChannelBuffer0);
        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  {
      Jt600FrameDecoder jt600FrameDecoder0 = new Jt600FrameDecoder();
      DefaultChannelPipeline defaultChannelPipeline0 = new DefaultChannelPipeline();
      Class<ChannelHandler> class0 = ChannelHandler.class;
      ChannelHandlerContext channelHandlerContext0 = defaultChannelPipeline0.getContext(class0);
      DefaultLocalServerChannelFactory defaultLocalServerChannelFactory0 = new DefaultLocalServerChannelFactory();
      LocalServerChannel localServerChannel0 = defaultLocalServerChannelFactory0.newChannel(defaultChannelPipeline0);
      byte[] byteArray0 = new byte[10];
      LittleEndianHeapChannelBuffer littleEndianHeapChannelBuffer0 = new LittleEndianHeapChannelBuffer(byteArray0);
      DuplicatedChannelBuffer duplicatedChannelBuffer0 = new DuplicatedChannelBuffer(littleEndianHeapChannelBuffer0);
      try { 
        jt600FrameDecoder0.decode(channelHandlerContext0, localServerChannel0, duplicatedChannelBuffer0);
        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();
      try { 
        jt600FrameDecoder0.decode((ChannelHandlerContext) null, (Channel) null, (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();
      DefaultLocalClientChannelFactory defaultLocalClientChannelFactory0 = new DefaultLocalClientChannelFactory();
      LocalChannel localChannel0 = defaultLocalClientChannelFactory0.newChannel(defaultChannelPipeline0);
      HeapChannelBufferFactory heapChannelBufferFactory0 = new HeapChannelBufferFactory();
      ByteOrder byteOrder0 = ByteOrder.LITTLE_ENDIAN;
      ChannelBuffer channelBuffer0 = heapChannelBufferFactory0.getBuffer(byteOrder0, 1024);
      channelBuffer0.writeInt(40);
      TruncatedChannelBuffer truncatedChannelBuffer0 = new TruncatedChannelBuffer(channelBuffer0, 125);
      jt600FrameDecoder0.decode((ChannelHandlerContext) null, localChannel0, truncatedChannelBuffer0);
      //  // Unstable assertion: assertEquals(9, (int)localChannel0.getId());
  }

  @Test(timeout = 4000)
  public void test4()  throws Throwable  {
      Jt600FrameDecoder jt600FrameDecoder0 = new Jt600FrameDecoder();
      DefaultChannelPipeline defaultChannelPipeline0 = new DefaultChannelPipeline();
      DefaultLocalServerChannelFactory defaultLocalServerChannelFactory0 = new DefaultLocalServerChannelFactory();
      LocalServerChannel localServerChannel0 = defaultLocalServerChannelFactory0.newChannel(defaultChannelPipeline0);
      byte[] byteArray0 = new byte[9];
      LittleEndianHeapChannelBuffer littleEndianHeapChannelBuffer0 = new LittleEndianHeapChannelBuffer(byteArray0);
      DuplicatedChannelBuffer duplicatedChannelBuffer0 = new DuplicatedChannelBuffer(littleEndianHeapChannelBuffer0);
      jt600FrameDecoder0.decode((ChannelHandlerContext) null, localServerChannel0, duplicatedChannelBuffer0);
      assertEquals(0, (int)localServerChannel0.getId());
  }
}
