ScreenMessage implements Message { public Builder toBuilder() { return new Builder(this); }  static Builder builder(String name); abstract String name(); @Nullable abstract Map<String, ?> properties(); Builder toBuilder();  }
@Test public void toBuilder() { ScreenMessage original = ScreenMessage.builder("name") .properties(ImmutableMap.of("foo", "bar")) .userId("userId") .build(); ScreenMessage copy = original.toBuilder().build(); assertThat(copy.name()).isEqualTo("name"); assertThat(copy.properties()).isEqualTo(ImmutableMap.of("foo", "bar")); }