public static Optional<Integer> getLatestSchemaId(
      final SchemaRegistryClient srClient,
      final String topic,
      final boolean isKey
  ) {
    final String subject = KsqlConstants.getSRSubject(topic, isKey);
    return getLatestSchema(srClient, subject).map(SchemaMetadata::getId);
  }
@Test
  public void shouldReturnSchemaIdFromSubjectKey() throws Exception {
    // Given:
    when(schemaMetadata.getId()).thenReturn(123);
    when(schemaRegistryClient.getLatestSchemaMetadata("bar-key"))
        .thenReturn(schemaMetadata);

    // When:
    final Optional<Integer> schemaId =
        SchemaRegistryUtil.getLatestSchemaId(schemaRegistryClient, "bar", true);

    // Then:
    assertThat(schemaId.get(), equalTo(123));
  }