ImmutableResourceStatus implements ResourceStatus { public static ResourceStatus fromJson(final JsonObject jsonObject) { final ResourceType readType = ResourceType.forName( jsonObject.getValueOrThrow(JsonFields.TYPE)).orElse(ResourceType.UNKNOWN); final String readClient = jsonObject.getValueOrThrow(JsonFields.CLIENT); final ConnectivityStatus readConnectionStatus = ConnectivityStatus.forName( jsonObject.getValueOrThrow(JsonFields.STATUS)).orElse(ConnectivityStatus.UNKNOWN); final String readAddress = jsonObject.getValue(JsonFields.ADDRESS).orElse(null); final String readConnectionStatusDetails = jsonObject.getValue(JsonFields.STATUS_DETAILS).orElse(null); final Instant readInStateSince = jsonObject.getValue(JsonFields.IN_STATE_SINCE).map(Instant::parse).orElse(null); return ImmutableResourceStatus.of(readType, readClient, readConnectionStatus, readAddress, readConnectionStatusDetails, readInStateSince); } private  ImmutableResourceStatus(final ResourceType type, final String client, final ConnectivityStatus status,
            @Nullable final String address,
            @Nullable final String statusDetails,
            @Nullable final Instant inStateSince); static ImmutableResourceStatus of(final ResourceType type, final String client,
            final ConnectivityStatus status,
            @Nullable final String address,
            @Nullable final String statusDetails,
            @Nullable final Instant inStateSince); static ImmutableResourceStatus of(final ResourceType type, final String client,
            final ConnectivityStatus status,
            @Nullable final String address,
            @Nullable final String statusDetails); @Override ResourceType getResourceType(); @Override String getClient(); @Override Optional<String> getAddress(); @Override ConnectivityStatus getStatus(); @Override Optional<String> getStatusDetails(); @Override Optional<Instant> getInStateSince(); @Override JsonObject toJson(final JsonSchemaVersion schemaVersion, final Predicate<JsonField> thePredicate); static ResourceStatus fromJson(final JsonObject jsonObject); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString();  }
@Test public void fromJsonReturnsExpected() { final ResourceStatus actual = ImmutableResourceStatus.fromJson(RESOURCE_STATUS_JSON); assertThat(actual).isEqualTo(RESOURCE_STATUS); }