### Question:
CodecUtils { public static RawType getTypeFromName(String name) { if (name == null) { name = "varchar"; } RawType rawType = nativeTypeMap.get(name); if (rawType == null) { rawType = typeCache.computeIfAbsent(name, RawTypeParser::resolveRawTypeFromName); } return rawType; }  static List<ByteBuffer> row(ByteBuffer... columns); static Queue<List<ByteBuffer>> singletonRow(ByteBuffer... columns); @SafeVarargs static Queue<List<ByteBuffer>> rows(List<ByteBuffer>... rows); @SuppressWarnings("unchecked") static ByteBuffer encodePeerInfo(
      AbstractNode node, Encoder<T> encoder, String key, T defaultValue); static RawType primitive(int code); static RawType getTypeFromName(String name); static List<ColumnSpec> columnSpecs(ColumnSpec... colSpecs); static ColumnSpecBuilder columnSpecBuilder(); static ColumnSpecBuilder columnSpecBuilder(String keyspace, String table); static Logger logger; }### Answer:
@Test public void testGetTypeFromNameRepeatedCallsShouldReturnSameObject() { for (String name : new String[] {"ascii", "set<ascii>", "tuple<int,int,list<ascii>>"}) { RawType rawType = CodecUtils.getTypeFromName(name); for (int i = 0; i < 10; i++) { assertThat(CodecUtils.getTypeFromName(name)).isNotNull().isSameAs(rawType); } } }
@Test public void testGetTypeFromNameShouldNotResolveNonPrimitiveNames() { String[] nonPrimitiveNames = {"custom", "list", "map", "set", "udt", "tuple"}; for (String name : nonPrimitiveNames) { try { assertThat(CodecUtils.getTypeFromName(name)).isNull(); fail("InvalidTypeException expected for " + name); } catch (InvalidTypeException ite) { } } }
@Test public void testGetTypeFromNameBadSyntax() { String[] badSyntax = {"map<string, int", "map<string>", "list<<>>", ""}; for (String name : badSyntax) { try { assertThat(CodecUtils.getTypeFromName(name)).isNull(); fail("InvalidTypeException expected for " + name); } catch (InvalidTypeException ite) { } } }
@Test public void testGetTypeFromNameCustom() { assertThat(CodecUtils.getTypeFromName("'IAMCustom'")).isEqualTo(new RawCustom("IAMCustom")); assertThat(CodecUtils.getTypeFromName("empty")).isEqualTo(new RawCustom("empty")); }