TypeHelper { static String getTypeExpressionFor(ParsedType currentParsedType) { if(currentParsedType.parameters.isEmpty()) { return String.format("%s.class", currentParsedType.className); } else { return String.format("Types.newParameterizedType(%s.class, %s)", currentParsedType.className, FluentIterable.from(currentParsedType.parameters) .transform(new Function<ParsedType, String>() { @Override public String apply(ParsedType param) { return getTypeExpressionFor(param); } }).join(Joiner.on(", ")) ); } }  static OptionalMatchingType optionalMatchingTypeOf(String type);  }
@Test public void should_produce_type_expression() throws Exception { assertThat(TypeHelper.getTypeExpressionFor(this.stringedType)).isEqualTo(this.expectedTypeExpression); }