@Test
  public void parametrizedTypeType_methods_tests() {
    JavaSymbol.PackageJavaSymbol packageSymbol =
        new JavaSymbol.PackageJavaSymbol("org.foo.bar", null);
    JavaSymbol.TypeJavaSymbol typeSymbol =
        new JavaSymbol.TypeJavaSymbol(Flags.PUBLIC, "MyType", packageSymbol);
    JavaSymbol.TypeVariableJavaSymbol typeVariableSymbol =
        new JavaSymbol.TypeVariableJavaSymbol("E", typeSymbol);
    ClassJavaType classType = (ClassJavaType) typeSymbol.type;
    TypeVariableJavaType typeVariableType = (TypeVariableJavaType) typeVariableSymbol.type;
    TypeSubstitution typeSubstitution = new TypeSubstitution();
    typeSubstitution.add(typeVariableType, classType);

    ParametrizedTypeJavaType ptt = new ParametrizedTypeJavaType(typeSymbol, typeSubstitution);
    assertThat(ptt.substitution(typeVariableType)).isEqualTo(classType);
    assertThat(
            ptt.substitution(
                new TypeVariableJavaType(new JavaSymbol.TypeVariableJavaSymbol("F", typeSymbol))))
        .isNull();
    assertThat(ptt.typeParameters()).hasSize(1);
    assertThat(ptt.typeParameters()).contains(typeVariableType);

    ptt = new ParametrizedTypeJavaType(typeSymbol, null);
    assertThat(ptt.substitution(typeVariableType)).isNull();
    assertThat(ptt.typeParameters()).isEmpty();

    assertThat(ptt.isClass()).isTrue();
    assertThat(ptt.isParameterized()).isTrue();
    assertThat(ptt.rawType.isClass()).isTrue();
    assertThat(ptt.rawType.isParameterized()).isFalse();
  }
  @Test
  public void erasure_of_type_variable() {
    JavaSymbol.TypeJavaSymbol typeSymbol =
        new JavaSymbol.TypeJavaSymbol(
            Flags.PUBLIC, "MyType", new JavaSymbol.PackageJavaSymbol("org.foo.bar", null));
    TypeSubstitution typeSubstitution = new TypeSubstitution();
    typeSubstitution.add(
        (TypeVariableJavaType) new JavaSymbol.TypeVariableJavaSymbol("T", typeSymbol).type,
        typeSymbol.type);
    ParametrizedTypeJavaType parametrizedType =
        new ParametrizedTypeJavaType(typeSymbol, typeSubstitution);

    TypeVariableJavaType typeVariableType =
        (TypeVariableJavaType) new JavaSymbol.TypeVariableJavaSymbol("X", typeSymbol).type;
    typeVariableType.bounds = ImmutableList.<JavaType>of(parametrizedType);

    assertThat(typeVariableType.erasure()).isNotEqualTo(parametrizedType);
    assertThat(typeVariableType.erasure()).isEqualTo(parametrizedType.erasure());
  }