@Test
  @SuppressWarnings("TypeEquals") // We want to test the equals method invocation on TypeMirror.
  public void testTypeMirrorSet() {
    // Test the TypeMirrorSet methods. Resist the temptation to rewrite these in terms of
    // Truth operations! For example, don't change assertThat(set.size()).isEqualTo(0) into
    // assertThat(set).isEmpty(), because then we wouldn't be testing size().
    TypeMirror objectMirror = objectMirror();
    TypeMirror otherObjectMirror = cloneReturnTypeMirror();
    Set<TypeMirror> set = new TypeMirrorSet();
    assertThat(set.size()).isEqualTo(0);
    assertThat(set.isEmpty()).isTrue();
    boolean added = set.add(objectMirror);
    assertThat(added).isTrue();
    assertThat(set.size()).isEqualTo(1);

    Set<TypeMirror> otherSet = typeMirrorSet(otherObjectMirror);
    assertThat(otherSet).isEqualTo(set);
    assertThat(set).isEqualTo(otherSet);
    assertThat(otherSet.hashCode()).isEqualTo(set.hashCode());

    assertThat(set.add(otherObjectMirror)).isFalse();
    assertThat(set.contains(otherObjectMirror)).isTrue();

    assertThat(set.contains(null)).isFalse();
    assertThat(set.contains((Object) "foo")).isFalse();
    assertThat(set.remove(null)).isFalse();
    assertThat(set.remove((Object) "foo")).isFalse();

    TypeElement list = typeElementOf(java.util.List.class);
    TypeMirror listOfObjectMirror = typeUtils.getDeclaredType(list, objectMirror);
    TypeMirror listOfOtherObjectMirror = typeUtils.getDeclaredType(list, otherObjectMirror);
    assertThat(listOfObjectMirror.equals(listOfOtherObjectMirror)).isFalse();
    assertThat(typeUtils.isSameType(listOfObjectMirror, listOfOtherObjectMirror)).isTrue();
    added = set.add(listOfObjectMirror);
    assertThat(added).isTrue();
    assertThat(set.size()).isEqualTo(2);
    assertThat(set.add(listOfOtherObjectMirror)).isFalse();
    assertThat(set.contains(listOfOtherObjectMirror)).isTrue();

    boolean removed = set.remove(listOfOtherObjectMirror);
    assertThat(removed).isTrue();
    assertThat(set.contains(listOfObjectMirror)).isFalse();

    set.removeAll(otherSet);
    assertThat(set.isEmpty()).isTrue();
  }
This test shows why we need to have TypeMirrorSet. The mirror of java.lang.Object obtained from
{@link Elements#getTypeElement Elements.getTypeElement("java.lang.Object")} does not compare
equal to the mirror of the return type of Object.clone(), even though that is also
java.lang.Object and {@link Types#isSameType} considers them the same.

<p>There's no requirement that this test must pass and if it starts failing or doesn't work in
another test environment then we can delete it. The specification of {@link TypeMirror#equals}
explicitly says that it cannot be used for type equality, so even if this particular case stops
being a problem (which means this test would fail), we would need TypeMirrorSet for complete
correctness.
value/src/test/java/com/google/auto/value/processor/TypeSimplifierTest.java