public SubscriptionName createSubscription(TopicName topicName, String subscriptionName) {
    checkArgument(!subscriptionName.isEmpty(), "subscriptionName can not be empty");
    checkIsUsable();

    if (!createdTopics.contains(topicName)) {
      throw new IllegalArgumentException(
          "Can not create a subscription for a topic not managed by this instance.");
    }

    LOG.info("Creating subscription '{}' for topic '{}'", subscriptionName, topicName);

    Subscription subscription =
        Failsafe.with(retryOnDeadlineExceeded())
            .get(
                () ->
                    subscriptionAdminClient.createSubscription(
                        getSubscriptionName(subscriptionName),
                        topicName,
                        PushConfig.getDefaultInstance(),
                        DEFAULT_ACK_DEADLINE_SECONDS));
    SubscriptionName reference = PubsubUtils.toSubscriptionName(subscription);
    createdSubscriptions.add(getSubscriptionName(subscriptionName));

    LOG.info(
        "Subscription '{}' for topic '{}' was created successfully!",
        subscription.getName(),
        topicName);

    return reference;
  }
@Test
  public void testCreateSubscriptionUnmanagedTopicShouldFail() {
    IllegalArgumentException exception =
        assertThrows(
            IllegalArgumentException.class,
            () ->
                testManager.createSubscription(
                    TopicName.of(PROJECT_ID, "topic-name"), "subscription-name"));
    assertThat(exception).hasMessageThat().contains("topic not managed");
  }