public static boolean subjectExists(
      final SchemaRegistryClient srClient,
      final String subject
  ) {
    return getLatestSchema(srClient, subject).isPresent();
  }
@Test
  public void shouldReturnFalseOnSubjectMissing() throws Exception {
    // Given:
    when(schemaRegistryClient.getLatestSchemaMetadata("bar-value")).thenThrow(
        new RestClientException("foo", 404, SchemaRegistryUtil.SUBJECT_NOT_FOUND_ERROR_CODE)
    );

    // When:
    final boolean subjectExists = SchemaRegistryUtil.subjectExists(schemaRegistryClient, "bar-value");

    // Then:
    assertFalse("Expected subject to not exist", subjectExists);
  }