PredicateFieldValue extends FieldValue { @Override public void assign(Object o) { if (o == null) { predicate = null; } else if (o instanceof Predicate) { predicate = (Predicate)o; } else if (o instanceof PredicateFieldValue) { predicate = ((PredicateFieldValue)o).predicate; } else { throw new IllegalArgumentException("Expected " + getClass().getName() + ", got " + o.getClass().getName() + "."); } } PredicateFieldValue();  PredicateFieldValue(Predicate predicate);  PredicateFieldValue(String predicateString); Predicate getPredicate(); PredicateFieldValue setPredicate(Predicate predicate); @Override DataType getDataType(); @Override void printXml(XmlStream xml); @Override void clear(); @Override void assign(Object o); @Override void serialize(Field field, FieldWriter writer); @Override void deserialize(Field field, FieldReader reader); @Override Object getWrappedValue(); @Override PredicateFieldValue clone(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); static PrimitiveDataType.Factory getFactory();  }
@Test public void requireThatBadAssignThrows() { try { new PredicateFieldValue().assign(new Object()); fail(); } catch (IllegalArgumentException e) { assertEquals("Expected com.yahoo.document.datatypes.PredicateFieldValue, got java.lang.Object.", e.getMessage()); } }