Skip to content

Commit b872399

Browse files
committed
Fix deleted topic name: _deleted_topic_ -> _deleted-topic_ (#1023)
1 parent 235152e commit b872399

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/TopicId.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
public final class TopicId implements Serializable {
3434

3535
private static final long serialVersionUID = -4913169763174877777L;
36-
private static final String DELETED_TOPIC_NAME = "_deleted_topic_";
36+
private static final String DELETED_TOPIC_NAME = "_deleted-topic_";
3737
private static final TopicId DELETED_TOPIC = new TopicId(null, DELETED_TOPIC_NAME, true);
3838

3939
private final String project;
@@ -68,7 +68,7 @@ public String topic() {
6868
/**
6969
* Returns {@code true} if this object is the identity of a deleted topic, {@code false}
7070
* otherwhise. If {@code isDeleted()} is {@code true}, {@link #topic()} returns
71-
* "{@code _deleted_topic_}" and {@link #project()} returns {@code null}.
71+
* "{@code _deleted-topic_}" and {@link #project()} returns {@code null}.
7272
*/
7373
public boolean isDeleted() {
7474
return isDeleted;

gcloud-java-pubsub/src/test/java/com/google/cloud/pubsub/SubscriptionInfoTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public void testToAndFromPb() {
113113
SubscriptionInfo.fromPb(subscriptionInfo.toPb("project")));
114114
com.google.pubsub.v1.Subscription subscription = SUBSCRIPTION_INFO.toPb("project");
115115
subscriptionInfo =
116-
SubscriptionInfo.fromPb(subscription.toBuilder().setTopic("_deleted_topic_").build());
116+
SubscriptionInfo.fromPb(subscription.toBuilder().setTopic("_deleted-topic_").build());
117117
assertEquals(TopicId.deletedTopic(), subscriptionInfo.topic());
118118
assertEquals(NAME, subscriptionInfo.name());
119119
assertEquals(PUSH_CONFIG, subscriptionInfo.pushConfig());

gcloud-java-pubsub/src/test/java/com/google/cloud/pubsub/TopicIdTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public class TopicIdTest {
2929
private static final String PROJECT = "project";
3030
private static final String NAME = "topic";
3131
private static final String TOPIC_PB = "projects/project/topics/topic";
32+
private static final String DELETED_TOPIC_NAME = "_deleted-topic_";
3233

3334
@Test
3435
public void testOf() {
@@ -45,7 +46,7 @@ public void testOf() {
4546
public void testDeletedTopic() {
4647
TopicId deletedTopic = TopicId.deletedTopic();
4748
assertNull(deletedTopic.project());
48-
assertEquals("_deleted_topic_", deletedTopic.topic());
49+
assertEquals(DELETED_TOPIC_NAME, deletedTopic.topic());
4950
assertTrue(deletedTopic.isDeleted());
5051
assertSame(deletedTopic, TopicId.deletedTopic());
5152
}
@@ -60,6 +61,7 @@ public void testToAndFromPb() {
6061
topicPb = topicId.toPb("otherProject");
6162
assertEquals("projects/otherProject/topics/topic", topicPb);
6263
compareTopicId(TopicId.of("otherProject", NAME), TopicId.fromPb(topicPb));
64+
assertSame(TopicId.deletedTopic(), TopicId.fromPb(DELETED_TOPIC_NAME));
6365
}
6466

6567
private void compareTopicId(TopicId expected, TopicId value) {

0 commit comments

Comments
 (0)