@Test public void build() { TargetableNotificationPreference preference1 = this.builder.prepare() .setCategory(NotificationPreferenceCategory.DEFAULT) .setEnabled(true) .setFormat(NotificationFormat.ALERT) .setProperties(Collections.singletonMap(NotificationPreferenceProperty.EVENT_TYPE, "foo")) .setStartDate(new Date(42)) .setProviderHint("MyHint") .setTarget(new DocumentReference("xwiki", "Space", "Page")) .build(); TargetableNotificationPreference preference2 = this.builder.prepare() .setCategory(NotificationPreferenceCategory.DEFAULT) .setEnabled(true) .setFormat(NotificationFormat.ALERT) .setProperties(Collections.singletonMap(NotificationPreferenceProperty.EVENT_TYPE, "foo")) .setStartDate(new Date(42)) .setProviderHint("MyHint") .setTarget(new DocumentReference("xwiki", "Space", "Page")) .build(); assertNotSame(preference1, preference2); assertEquals(preference1, preference2); assertEquals(preference1.hashCode(), preference2.hashCode()); preference2 = this.builder.prepare() .setCategory(NotificationPreferenceCategory.SYSTEM) .setEnabled(false) .setFormat(NotificationFormat.ALERT) .setProperties(Collections.singletonMap(NotificationPreferenceProperty.EVENT_TYPE, "foo")) .setStartDate(new Date(88)) .setProviderHint("AnotherHint") .setTarget(new DocumentReference("xwiki", "Space", "Page")) .build(); assertNotSame(preference1, preference2); assertEquals(preference1, preference2); assertEquals(preference1.hashCode(), preference2.hashCode()); preference2 = this.builder.prepare() .setCategory(NotificationPreferenceCategory.DEFAULT) .setEnabled(true) .setFormat(NotificationFormat.EMAIL) .setProperties(Collections.singletonMap(NotificationPreferenceProperty.EVENT_TYPE, "foo")) .setStartDate(new Date(42)) .setProviderHint("MyHint") .setTarget(new DocumentReference("xwiki", "Space", "Page")) .build(); assertNotSame(preference1, preference2); assertNotEquals(preference1, preference2); assertNotEquals(preference1.hashCode(), preference2.hashCode()); preference2 = this.builder.prepare() .setCategory(NotificationPreferenceCategory.DEFAULT) .setEnabled(true) .setFormat(NotificationFormat.ALERT) .setProperties(Collections.singletonMap(NotificationPreferenceProperty.EVENT_TYPE, "bar")) .setStartDate(new Date(42)) .setProviderHint("MyHint") .setTarget(new DocumentReference("xwiki", "Space", "Page")) .build(); assertNotSame(preference1, preference2); assertNotEquals(preference1, preference2); assertNotEquals(preference1.hashCode(), preference2.hashCode()); preference2 = this.builder.prepare() .setCategory(NotificationPreferenceCategory.DEFAULT) .setEnabled(true) .setFormat(NotificationFormat.ALERT) .setProperties(Collections.singletonMap(NotificationPreferenceProperty.EVENT_TYPE, "foo")) .setStartDate(new Date(42)) .setProviderHint("MyHint") .setTarget(new DocumentReference("xwiki", "Space", "Page2")) .build(); assertNotSame(preference1, preference2); assertEquals(preference1, preference2); assertEquals(preference1.hashCode(), preference2.hashCode()); }
@Override public TargetableNotificationPreference build() { return preference; }
DefaultTargetableNotificationPreferenceBuilder implements TargetableNotificationPreferenceBuilder { @Override public TargetableNotificationPreference build() { return preference; } }
DefaultTargetableNotificationPreferenceBuilder implements TargetableNotificationPreferenceBuilder { @Override public TargetableNotificationPreference build() { return preference; }  }
DefaultTargetableNotificationPreferenceBuilder implements TargetableNotificationPreferenceBuilder { @Override public TargetableNotificationPreference build() { return preference; }  @Override TargetableNotificationPreference build(); @Override TargetableNotificationPreferenceBuilder prepare(); @Override TargetableNotificationPreferenceBuilder setEnabled(boolean isEnabled); @Override TargetableNotificationPreferenceBuilder setFormat(NotificationFormat format); @Override TargetableNotificationPreferenceBuilder setProperties(Map<NotificationPreferenceProperty, Object> properties); @Override TargetableNotificationPreferenceBuilder setProviderHint(String providerHint); @Override TargetableNotificationPreferenceBuilder setStartDate(Date startDate); @Override TargetableNotificationPreferenceBuilder setTarget(EntityReference target); @Override TargetableNotificationPreferenceBuilder setCategory(NotificationPreferenceCategory category); }
DefaultTargetableNotificationPreferenceBuilder implements TargetableNotificationPreferenceBuilder { @Override public TargetableNotificationPreference build() { return preference; }  @Override TargetableNotificationPreference build(); @Override TargetableNotificationPreferenceBuilder prepare(); @Override TargetableNotificationPreferenceBuilder setEnabled(boolean isEnabled); @Override TargetableNotificationPreferenceBuilder setFormat(NotificationFormat format); @Override TargetableNotificationPreferenceBuilder setProperties(Map<NotificationPreferenceProperty, Object> properties); @Override TargetableNotificationPreferenceBuilder setProviderHint(String providerHint); @Override TargetableNotificationPreferenceBuilder setStartDate(Date startDate); @Override TargetableNotificationPreferenceBuilder setTarget(EntityReference target); @Override TargetableNotificationPreferenceBuilder setCategory(NotificationPreferenceCategory category);  }