SubscriptionRecord { static SubscriptionRecord of(Subscription subscription) { if (subscription.ofEvent()) { return createEventRecord(subscription); } return createEntityRecord(subscription); } private  SubscriptionRecord(Subscription s, TypeUrl targetType, UpdateHandler handler); @Override boolean equals(Object o); @Override int hashCode();  }
@Test @DisplayName("be equal only to SubscriptionRecord that has same subscription") void beEqualToSame() { Subscription oneSubscription = subscription(); SubscriptionId breakingId = Subscriptions.newId("breaking-id"); Subscription otherSubscription = oneSubscription .toBuilder() .setId(breakingId) .build(); @SuppressWarnings("QuestionableName") SubscriptionRecord one = SubscriptionRecord.of(oneSubscription); SubscriptionRecord similar = SubscriptionRecord.of(otherSubscription); SubscriptionRecord same = SubscriptionRecord.of(oneSubscription); assertNotEquals(one, similar); assertEquals(one, same); }