### Question:
EqualToRelation implements FieldSpecRelation { @Override public FieldSpec createModifierFromOtherValue(DataBagValue otherFieldGeneratedValue) { if (otherFieldGeneratedValue.getValue() == null){ return FieldSpecFactory.nullOnly(); } return FieldSpecFactory.fromList(DistributedList.singleton(otherFieldGeneratedValue.getValue())); } EqualToRelation(Field main, Field other); @Override FieldSpec createModifierFromOtherFieldSpec(FieldSpec otherFieldSpec); @Override FieldSpec createModifierFromOtherValue(DataBagValue otherFieldGeneratedValue); @Override FieldSpecRelation inverse(); @Override Field main(); @Override Field other(); @Override Constraint negate();  }### Answer:
@Test public void testReduceToFieldSpec_withNotNull_reducesToSpec() { OffsetDateTime value = OffsetDateTime.of(2000, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC); DataBagValue generatedValue = new DataBagValue(value); FieldSpec result = equalToDateRelations.createModifierFromOtherValue(generatedValue); FieldSpec expected = FieldSpecFactory.fromList(DistributedList.singleton(value)); assertThat(result, sameBeanAs(expected)); }
@Test public void testReduceToFieldSpec_withNull_reducesToSpec() { OffsetDateTime value = null; DataBagValue generatedValue = new DataBagValue(value); FieldSpec result = equalToDateRelations.createModifierFromOtherValue(generatedValue); FieldSpec expected = FieldSpecFactory.nullOnly(); assertThat(result, sameBeanAs(expected)); }