@SuppressWarnings("unchecked") protected Property<?> createMockedProperty(Object id, Object displayName, Object value) { Property<String> property = mock(Property.class); when(property.getId()).thenReturn(id.toString()).toString(); when(property.getDisplayName()).thenReturn(displayName.toString()); when(property.getValueAsString()).thenReturn(value == null ? "" : value.toString()); PropertyDefinition def = mock(PropertyDefinition.class); when(def.getPropertyType()).thenReturn(PropertyType.STRING); when(property.getDefinition()).thenReturn(def); return property; }