### Question:
AbstractCassandraProcessor extends AbstractProcessor { public static String getPrimitiveAvroTypeFromCassandraType(DataType dataType) { if (dataType.equals(DataType.ascii()) || dataType.equals(DataType.text()) || dataType.equals(DataType.varchar()) || dataType.equals(DataType.timestamp()) || dataType.equals(DataType.timeuuid()) || dataType.equals(DataType.uuid()) || dataType.equals(DataType.inet()) || dataType.equals(DataType.varint())) { return "string"; } else if (dataType.equals(DataType.cboolean())) { return "boolean"; } else if (dataType.equals(DataType.cint())) { return "int"; } else if (dataType.equals(DataType.bigint()) || dataType.equals(DataType.counter())) { return "long"; } else if (dataType.equals(DataType.cfloat())) { return "float"; } else if (dataType.equals(DataType.cdouble())) { return "double"; } else if (dataType.equals(DataType.blob())) { return "bytes"; } else { throw new IllegalArgumentException("createSchema: Unknown Cassandra data type " + dataType.getName() + " cannot be converted to Avro type"); } }  void stop(); static Schema getUnionFieldType(String dataType); static Schema getSchemaForType(String dataType); static String getPrimitiveAvroTypeFromCassandraType(DataType dataType); static DataType getPrimitiveDataTypeFromString(String dataTypeName); List<InetSocketAddress> getContactPoints(String contactPointList); static final int DEFAULT_CASSANDRA_PORT; static final PropertyDescriptor CONTACT_POINTS; static final PropertyDescriptor KEYSPACE; static final PropertyDescriptor PROP_SSL_CONTEXT_SERVICE; static final PropertyDescriptor CLIENT_AUTH; static final PropertyDescriptor USERNAME; static final PropertyDescriptor PASSWORD; static final PropertyDescriptor CONSISTENCY_LEVEL; static final PropertyDescriptor CHARSET; }### Answer:
@Test public void testGetPrimitiveAvroTypeFromCassandraType() throws Exception { assertEquals("string", AbstractCassandraProcessor.getPrimitiveAvroTypeFromCassandraType(DataType.ascii())); assertEquals("string", AbstractCassandraProcessor.getPrimitiveAvroTypeFromCassandraType(DataType.text())); assertEquals("string", AbstractCassandraProcessor.getPrimitiveAvroTypeFromCassandraType(DataType.varchar())); assertEquals("string", AbstractCassandraProcessor.getPrimitiveAvroTypeFromCassandraType(DataType.timestamp())); assertEquals("string", AbstractCassandraProcessor.getPrimitiveAvroTypeFromCassandraType(DataType.timeuuid())); assertEquals("string", AbstractCassandraProcessor.getPrimitiveAvroTypeFromCassandraType(DataType.uuid())); assertEquals("string", AbstractCassandraProcessor.getPrimitiveAvroTypeFromCassandraType(DataType.inet())); assertEquals("string", AbstractCassandraProcessor.getPrimitiveAvroTypeFromCassandraType(DataType.varint())); assertEquals("boolean", AbstractCassandraProcessor.getPrimitiveAvroTypeFromCassandraType(DataType.cboolean())); assertEquals("int", AbstractCassandraProcessor.getPrimitiveAvroTypeFromCassandraType(DataType.cint())); assertEquals("long", AbstractCassandraProcessor.getPrimitiveAvroTypeFromCassandraType(DataType.bigint())); assertEquals("long", AbstractCassandraProcessor.getPrimitiveAvroTypeFromCassandraType(DataType.counter())); assertEquals("float", AbstractCassandraProcessor.getPrimitiveAvroTypeFromCassandraType(DataType.cfloat())); assertEquals("double", AbstractCassandraProcessor.getPrimitiveAvroTypeFromCassandraType(DataType.cdouble())); assertEquals("bytes", AbstractCassandraProcessor.getPrimitiveAvroTypeFromCassandraType(DataType.blob())); }
@Test(expected = IllegalArgumentException.class) public void testGetPrimitiveAvroTypeFromCassandraTypeBadType() throws Exception { DataType mockDataType = mock(DataType.class); AbstractCassandraProcessor.getPrimitiveAvroTypeFromCassandraType(mockDataType); }