CloudFoundryContext extends Context { public static CloudFoundryContextBuilder builder() { return new CloudFoundryContextBuilder(); } private  CloudFoundryContext();  CloudFoundryContext(String organizationGuid, String organizationName, String spaceGuid, String spaceName,
			String instanceName, Map<String, Object> properties); @JsonAnyGetter Map<String, Object> getSerializableProperties(); @JsonProperty String getOrganizationGuid(); @JsonProperty String getOrganizationName(); @JsonProperty String getSpaceGuid(); @JsonProperty String getSpaceName(); @JsonProperty String getInstanceName(); static CloudFoundryContextBuilder builder(); static final String CLOUD_FOUNDRY_PLATFORM; static final String ORGANIZATION_GUID_KEY; static final String ORGANIZATION_NAME_KEY; static final String SPACE_GUID_KEY; static final String SPACE_NAME_KEY; static final String INSTANCE_NAME_KEY; }
@Test void partialContextIsSerialized() { Context context = CloudFoundryContext.builder().organizationGuid("org-guid") .spaceGuid("space-guid").build(); DocumentContext json = JsonUtils.toJsonPath(context); JsonPathAssert.assertThat(json).hasPath("$.organization_guid").isEqualTo("org-guid"); JsonPathAssert.assertThat(json).hasPath("$.space_guid").isEqualTo("space-guid"); JsonPathAssert.assertThat(json).hasPath("$.platform").isEqualTo("cloudfoundry"); JsonPathAssert.assertThat(json).hasMapAtPath("$").hasSize(3); JsonUtils.assertThatJsonHasExactNumberOfProperties(context, 3 + 1); }
@Test void fullContextIsSerialized() { Context context = CloudFoundryContext.builder() .organizationGuid("org-guid") .organizationName("org-name") .spaceGuid("space-guid") .spaceName("space-name") .instanceName("instance-name") .build(); DocumentContext json = JsonUtils.toJsonPath(context); JsonPathAssert.assertThat(json).hasPath("$.organization_guid").isEqualTo("org-guid"); JsonPathAssert.assertThat(json).hasPath("$.organization_name").isEqualTo("org-name"); JsonPathAssert.assertThat(json).hasPath("$.space_guid").isEqualTo("space-guid"); JsonPathAssert.assertThat(json).hasPath("$.space_name").isEqualTo("space-name"); JsonPathAssert.assertThat(json).hasPath("$.instance_name").isEqualTo("instance-name"); JsonPathAssert.assertThat(json).hasPath("$.platform").isEqualTo("cloudfoundry"); JsonPathAssert.assertThat(json).hasMapAtPath("$").hasSize(6); JsonUtils.assertThatJsonHasExactNumberOfProperties(context, 6 + 1); }