ColumnInfo { public static ColumnInfo fromString(String stringRepresentation) { List<String> components = Lists.newArrayList(Splitter.on(STR_SEPARATOR).split(stringRepresentation)); if (components.size() != 2) { throw new IllegalArgumentException("Unparseable string: " + stringRepresentation); } return new ColumnInfo( components.get(0), PDataType.fromSqlTypeName(components.get(1)).getSqlType()); } ColumnInfo(String columnName, int sqlType); String getColumnName(); int getSqlType(); PDataType getPDataType(); String getDisplayName(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); static ColumnInfo fromString(String stringRepresentation);  }
@Test(expected=IllegalArgumentException.class) public void testFromString_InvalidString() { ColumnInfo.fromString("invalid"); }
@Test public void testFromString_InvalidDataType() { try { ColumnInfo.fromString("COLNAME:badType"); } catch (RuntimeException e) { assertTrue(e.getCause() instanceof SQLException); SQLException sqlE = (SQLException)e.getCause(); assertEquals(SQLExceptionCode.ILLEGAL_DATA.getErrorCode(), sqlE.getErrorCode()); } }