public static String generateInstanceId(String baseString) {
    String instanceId =
        generateResourceId(
            baseString,
            ILLEGAL_INSTANCE_CHARS,
            REPLACE_INSTANCE_CHAR,
            MAX_INSTANCE_ID_LENGTH,
            INSTANCE_TIME_FORMAT);

    // if first char is not a letter, replace with letter, so it doesn't
    // violate spanner's instance naming rules
    if (!Character.isLetter(instanceId.charAt(0))) {
      char padding = generatePadding();
      instanceId = padding + instanceId.substring(1);
    }

    return instanceId;
  }
@Test
  public void testGenerateInstanceIdShouldReplaceNonLetterFirstCharWithLetter() {
    String testBaseString = "0-test";

    String actual = generateInstanceId(testBaseString);

    assertThat(actual).matches("[a-z]-test-\\d{8}-\\d{6}-\\d{6}");
  }