FieldMasks { public static <T extends GeneratedMessageV3> FieldMask allSetFieldsOf(T message) { Preconditions.checkNotNull(message, "message is null"); return compare((T) message.getDefaultInstanceForType(), message); }  static FieldMask compare(T original, T modified); static FieldMask allSetFieldsOf(T message);  }
@Test public void optionalField_withDefaultValue_detectsChange() { Campaign.Builder builder = Campaign.newBuilder(); builder.getManualCpcBuilder().setEnhancedCpcEnabled(false); Campaign campaign = builder.build(); assertEquals( ImmutableList.of("manual_cpc.enhanced_cpc_enabled"), FieldMasks.allSetFieldsOf(campaign).getPathsList()); }