content: /*
   * Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
   *
   * Licensed under the Amazon Software License (the "License").
   * You may not use this file except in compliance with the License.
   * A copy of the License is located at
   *
   * http://aws.amazon.com/asl/
   *
   * or in the "license" file accompanying this file. This file is distributed
   * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
   * express or implied. See the License for the specific language governing
   * permissions and limitations under the License.
   */
  
  package com.amazonaws.services.kinesis.stormspout.state.zookeeper;
  
  import java.io.IOException;
  import java.util.List;
  
  import org.junit.After;
  import org.junit.AfterClass;
  import org.junit.Before;
  import org.junit.BeforeClass;
  import org.junit.Test;
  
  import com.fasterxml.jackson.databind.ObjectMapper;
  import com.google.common.collect.ImmutableList;
  
  import junit.framework.Assert;
  
  /**
   *
   */
  public class ShardListV0Test {
  
      /**
       * @throws java.lang.Exception
       */
      @BeforeClass
      public static void setUpBeforeClass() throws Exception {
      }
  
      /**
       * @throws java.lang.Exception
       */
      @AfterClass
      public static void tearDownAfterClass() throws Exception {
      }
  
      /**
       * @throws java.lang.Exception
       */
      @Before
      public void setUp() throws Exception {
      }
  
      /**
       * @throws java.lang.Exception
       */
      @After
      public void tearDown() throws Exception {
      }
  
      /**
       * Test method for {@link com.amazonaws.services.kinesis.stormspout.state.zookeeper.ShardListV0#getShardList()}.
       * 
       * @throws IOException
       *             Thrown if we encounter errors when serializing/deserializing.
       */
      @Test
      public final void testJSONSerialization() throws IOException {
          List<String> shardList = new ImmutableList.Builder<String>().add("foo").add("bar").build();
          ShardListV0 shards = new ShardListV0(shardList);
          ObjectMapper objectMapper = new ObjectMapper();
          byte[] data = objectMapper.writeValueAsBytes(shards);
          Assert.assertTrue(data.length > 0);
  
          List<String> shardList2 = objectMapper.readValue(data, ShardListV0.class).getShardList();
          Assert.assertEquals(shardList.size(), shardList2.size());
      }
  
  }
  