### Question:
GraphUtil { static Object getNewPropertyValue(Object originalValue, Object newValue) { Class<?> clazz = checkNotNull(newValue).getClass(); boolean reduceToString = false; if (null != originalValue && originalValue.getClass().isArray()) { Class<?> originalClazz = Array.get(originalValue, 0).getClass(); if (!originalClazz.equals(clazz)) { reduceToString = true; clazz = String.class; } newValue = reduceToString ? newValue.toString() : newValue; Object newArray = Array.newInstance(clazz, Array.getLength(originalValue) + 1); for (int i = 0; i < Array.getLength(originalValue); i++) { Object val = Array.get(originalValue, i); if (newValue.equals(val)) { return originalValue; } Array.set(newArray, i, reduceToString ? val.toString() : val); } Array.set(newArray, Array.getLength(originalValue), newValue); return newArray; } else if (null != originalValue) { if (!clazz.equals(originalValue.getClass())) { reduceToString = true; clazz = String.class; } originalValue = reduceToString ? originalValue.toString() : originalValue; newValue = reduceToString ? newValue.toString() : newValue; if (!originalValue.equals(newValue)) { Object newArray = Array.newInstance(clazz, 2); Array.set(newArray, 0, originalValue); Array.set(newArray, 1, newValue); return newArray; } else { return originalValue; } } else { return newValue; } }  static void addProperty(PropertyContainer container, String property, Object value); static Optional<T> getProperty(PropertyContainer container, String property,
      Class<T> type); static Collection<T> getProperties(PropertyContainer container, String property,
      Class<T> type); static Iterable<Relationship> getRelationships(final Node a, final Node b,
      RelationshipType type, final boolean directed); static Iterable<Relationship> getRelationships(final Node a, final Node b,
      RelationshipType type); static boolean ignoreProperty(Object value);  }### Answer:
@Test public void newProperty_IsAtomicValue() { assertThat((String)GraphUtil.getNewPropertyValue(null, "1"), is("1")); }
@Test public void newProperty_IsMultiValuedArray() { assertThat((String[])GraphUtil.getNewPropertyValue("1", "2"), is(new String[]{"1", "2"})); }
@Test public void newProperty_IsMultiValuedArray_whenStartingFromAnArray() { assertThat((String[])GraphUtil.getNewPropertyValue(new String[]{"1", "2"}, "3"), is(new String[]{"1", "2", "3"})); }
@Test public void newProperties_useSetSemantics_fromSingleValues() { assertThat((String)GraphUtil.getNewPropertyValue("2", "2"), is("2")); }
@Test public void newProperties_useSetSemantics_fromMultipleValues() { assertThat((String[])GraphUtil.getNewPropertyValue(new String[]{"1", "2"}, "2"), is(new String[]{"1", "2"})); }
@Test public void heterogeneousValues_transformToStrings() { assertThat((String[])GraphUtil.getNewPropertyValue(1, "2"), is(new Object[]{"1", "2"})); }
@Test public void multipleHeterogeneousValues_transformToStrings() { assertThat((String[])GraphUtil.getNewPropertyValue(new int[]{1, 2}, "3"), is(new String[]{"1", "2", "3"})); }