Person { static Person createPerson(String email, String name) { return new AutoValue_Person(email, name); }  @JsonProperty abstract String getEmail(); @JsonProperty abstract String getName();  }
@Test public void testEquivalence() { equivalenceTester() .addEquivalentGroup(createPerson("foo@example.com", "Mr Foo"), createPerson("foo@example.com", "Mr Foo")) .addEquivalentGroup(createPerson("bar@example.com", "Mr Bar"), createPerson("bar@example.com", "Mr Bar")) .addEquivalentGroup(createPerson("foo@example.com", "Mr Bar"), createPerson("foo@example.com", "Mr Bar")) .addEquivalentGroup(createPerson("bar@example.com", "Mr Foo"), createPerson("bar@example.com", "Mr Foo")) .check(); }
@Test public void testJsonEncode() { assertJsonEncode(createPerson("alice@example.com", "Alice"), ImmutableMap.of( "name", "Alice", "email", "alice@example.com" )); }