PortableLocation { static PortableLocation fromLocation(Location location) { Objects.requireNonNull(location, "location must not be null"); return new PortableLocation( location.id(), location.coordinates().latitude(), location.coordinates().longitude(), location.description()); } @JsonCreator  PortableLocation(
            @JsonProperty(value = "id") long id,
            @JsonProperty(value = "lat") BigDecimal latitude,
            @JsonProperty(value = "lng") BigDecimal longitude,
            @JsonProperty(value = "description") String description); long getId(); BigDecimal getLatitude(); BigDecimal getLongitude(); String getDescription(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }
@Test void fromLocation() { Location location = new Location(17, Coordinates.valueOf(5.1, -0.0007), "Hello, world!"); PortableLocation portableLocation = PortableLocation.fromLocation(location); assertThat(portableLocation.getId()).isEqualTo(location.id()); assertThat(portableLocation.getLatitude()).isEqualTo(location.coordinates().latitude()); assertThat(portableLocation.getLongitude()).isEqualTo(location.coordinates().longitude()); assertThat(portableLocation.getDescription()).isEqualTo(location.description()); assertThatNullPointerException() .isThrownBy(() -> PortableLocation.fromLocation(null)) .withMessageContaining("location"); }