// Path: src/main/java/com/treasuredata/client/model/TDColumnType.java
// public static final TDColumnType FLOAT = new TDColumnType(TDTypeName.FLOAT, Optional.<List<TDColumnType>>absent());
// 
// Path: src/main/java/com/treasuredata/client/model/TDColumnType.java
// public static final TDColumnType INT = new TDColumnType(TDTypeName.INT, Optional.<List<TDColumnType>>absent());
// 
// Path: src/main/java/com/treasuredata/client/model/TDColumnType.java
// public static final TDColumnType LONG = new TDColumnType(TDTypeName.LONG, Optional.<List<TDColumnType>>absent());
// 
// Path: src/main/java/com/treasuredata/client/model/TDColumnType.java
// public static final TDColumnType STRING = new TDColumnType(TDTypeName.STRING, Optional.<List<TDColumnType>>absent());
// 
// Path: src/main/java/com/treasuredata/client/model/TDColumnType.java
// public static TDColumnType newArrayType(TDColumnType elementType)
// {
//     return new TDColumnType(TDTypeName.ARRAY, Optional.<List<TDColumnType>>of(ImmutableList.of(elementType)));
// }
// 
// Path: src/main/java/com/treasuredata/client/model/TDColumnType.java
// public static TDColumnType newMapType(TDColumnType keyType, TDColumnType valueType)
// {
//     return new TDColumnType(TDTypeName.MAP, Optional.<List<TDColumnType>>of(ImmutableList.of(keyType, valueType)));
// }
// 
// Path: src/main/java/com/treasuredata/client/model/TDColumnType.java
// public static TDColumnType parseColumnType(String str)
// {
//     Parser p = new Parser(str);
//     TDColumnType type = parseColumnTypeRecursive(p);
//     if (!p.eof()) {
//         throw new IllegalArgumentException("Cannot parse type: EOF expected: " + str);
//     }
//     return type;
// }


import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.ImmutableSet;
import org.junit.Test;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import static com.treasuredata.client.model.TDColumnType.FLOAT;
import static com.treasuredata.client.model.TDColumnType.INT;
import static com.treasuredata.client.model.TDColumnType.LONG;
import static com.treasuredata.client.model.TDColumnType.STRING;
import static com.treasuredata.client.model.TDColumnType.newArrayType;
import static com.treasuredata.client.model.TDColumnType.newMapType;
import static com.treasuredata.client.model.TDColumnType.parseColumnType;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
        checkSerialization(new TDColumn("str", TDColumnType.STRING));
        checkSerialization(new TDColumn("long", TDColumnType.LONG));
        checkSerialization(new TDColumn("double", TDColumnType.DOUBLE));
        checkSerialization(new TDColumn("float", TDColumnType.FLOAT));
        checkSerialization(newArrayType(TDColumnType.STRING));
        checkSerialization(newMapType(TDColumnType.INT, TDColumnType.STRING));
    }

    private static void checkJsonSerDe(TDColumn column)
                throws IOException
    {
         ObjectMapper mapper = new ObjectMapper();
         String json = mapper.writeValueAsString(column);
         TDColumn value = mapper.readValue(json, TDColumn.class);

         assertEquals(value.getName(), column.getName());
         assertEquals(value.getType(), column.getType());
         assertTrue(Arrays.equals(value.getKey(), column.getKey()));
     }

     @Test
     public void jsonSerDeTest()
             throws Exception
     {
         checkJsonSerDe(new TDColumn("int", TDColumnType.INT));
         checkJsonSerDe(new TDColumn("str", TDColumnType.STRING, "hello".getBytes(StandardCharsets.UTF_8)));
         checkJsonSerDe(new TDColumn("long", TDColumnType.LONG));
         checkJsonSerDe(new TDColumn("double", TDColumnType.DOUBLE, "world".getBytes(StandardCharsets.UTF_8)));
         checkJsonSerDe(new TDColumn("float", TDColumnType.FLOAT));
         checkJsonSerDe(new TDColumn("array_string", newArrayType(TDColumnType.STRING)));
// Path: src/main/java/com/treasuredata/client/model/TDColumnType.java
// public static final TDColumnType FLOAT = new TDColumnType(TDTypeName.FLOAT, Optional.<List<TDColumnType>>absent());
// 
// Path: src/main/java/com/treasuredata/client/model/TDColumnType.java
// public static final TDColumnType INT = new TDColumnType(TDTypeName.INT, Optional.<List<TDColumnType>>absent());
// 
// Path: src/main/java/com/treasuredata/client/model/TDColumnType.java
// public static final TDColumnType LONG = new TDColumnType(TDTypeName.LONG, Optional.<List<TDColumnType>>absent());
// 
// Path: src/main/java/com/treasuredata/client/model/TDColumnType.java
// public static final TDColumnType STRING = new TDColumnType(TDTypeName.STRING, Optional.<List<TDColumnType>>absent());
// 
// Path: src/main/java/com/treasuredata/client/model/TDColumnType.java
// public static TDColumnType newArrayType(TDColumnType elementType)
// {
//     return new TDColumnType(TDTypeName.ARRAY, Optional.<List<TDColumnType>>of(ImmutableList.of(elementType)));
// }
// 
// Path: src/main/java/com/treasuredata/client/model/TDColumnType.java
// public static TDColumnType newMapType(TDColumnType keyType, TDColumnType valueType)
// {
//     return new TDColumnType(TDTypeName.MAP, Optional.<List<TDColumnType>>of(ImmutableList.of(keyType, valueType)));
// }
// 
// Path: src/main/java/com/treasuredata/client/model/TDColumnType.java
// public static TDColumnType parseColumnType(String str)
// {
//     Parser p = new Parser(str);
//     TDColumnType type = parseColumnTypeRecursive(p);
//     if (!p.eof()) {
//         throw new IllegalArgumentException("Cannot parse type: EOF expected: " + str);
//     }
//     return type;
// }


// Path: src/test/java/com/treasuredata/client/model/TestTDColumn.java
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.ImmutableSet;
import org.junit.Test;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import static com.treasuredata.client.model.TDColumnType.FLOAT;
import static com.treasuredata.client.model.TDColumnType.INT;
import static com.treasuredata.client.model.TDColumnType.LONG;
import static com.treasuredata.client.model.TDColumnType.STRING;
import static com.treasuredata.client.model.TDColumnType.newArrayType;
import static com.treasuredata.client.model.TDColumnType.newMapType;
import static com.treasuredata.client.model.TDColumnType.parseColumnType;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

        checkSerialization(new TDColumn("str", TDColumnType.STRING));
        checkSerialization(new TDColumn("long", TDColumnType.LONG));
        checkSerialization(new TDColumn("double", TDColumnType.DOUBLE));
        checkSerialization(new TDColumn("float", TDColumnType.FLOAT));
        checkSerialization(newArrayType(TDColumnType.STRING));
        checkSerialization(newMapType(TDColumnType.INT, TDColumnType.STRING));
    }

    private static void checkJsonSerDe(TDColumn column)
                throws IOException
    {
         ObjectMapper mapper = new ObjectMapper();
         String json = mapper.writeValueAsString(column);
         TDColumn value = mapper.readValue(json, TDColumn.class);

         assertEquals(value.getName(), column.getName());
         assertEquals(value.getType(), column.getType());
         assertTrue(Arrays.equals(value.getKey(), column.getKey()));
     }

     @Test
     public void jsonSerDeTest()
             throws Exception
     {
         checkJsonSerDe(new TDColumn("int", TDColumnType.INT));
         checkJsonSerDe(new TDColumn("str", TDColumnType.STRING, "hello".getBytes(StandardCharsets.UTF_8)));
         checkJsonSerDe(new TDColumn("long", TDColumnType.LONG));
         checkJsonSerDe(new TDColumn("double", TDColumnType.DOUBLE, "world".getBytes(StandardCharsets.UTF_8)));
         checkJsonSerDe(new TDColumn("float", TDColumnType.FLOAT));
         checkJsonSerDe(new TDColumn("array_string", newArrayType(TDColumnType.STRING)));
         checkJsonSerDe(new TDColumn("map_string", newMapType(TDColumnType.INT, TDColumnType.STRING)));