AggregateType { public static AggregateType of(String aggregateStrType) { ArgumentChecker.notNull(aggregateStrType, "aggregateStrType"); validateAggregateType(aggregateStrType.toUpperCase()); List<ViewColumnType> types = Lists.newArrayListWithCapacity(VALID_AGGRAGATION_CHARS.size()); char[] chars = aggregateStrType.toCharArray(); for (char character : chars) { String shortName = String.valueOf(character); ViewColumnType type = ViewColumnType.of(shortName); if (type == null) { throw new IllegalArgumentException("Unsupported aggregate type: " + shortName); } types.add(type); } return new AggregateType(types); } private  AggregateType(List<ViewColumnType> aggregationTypes); static AggregateType of(String aggregateStrType); List<ViewColumnType> getColumnTypes(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); static final AggregateType NO_AGGREGATION; }
@Test(expectedExceptions=IllegalArgumentException.class) public void duplicateChar() { AggregateType.of("TTCV"); }
@Test(expectedExceptions=IllegalArgumentException.class) public void lessThan4CharsType() { AggregateType.of("TCV"); }
@Test(expectedExceptions=IllegalArgumentException.class) public void moreThan4CharsType() { AggregateType.of("TSCVT"); }
@Test(expectedExceptions=IllegalArgumentException.class) public void invalidChars() { AggregateType.of("TSCA"); }