AddGraphWithHooks extends AddGraph { @Override public AddGraphWithHooks shallowClone() throws CloneFailedException { Builder builder = new Builder() .graphId(getGraphId()) .schema(getSchema()) .storeProperties(getStoreProperties()) .parentSchemaIds(getParentSchemaIds()) .parentPropertiesId(getParentPropertiesId()) .options(getOptions()) .disabledByDefault(isDisabledByDefault()) .isPublic(getIsPublic()) .readAccessPredicate(getReadAccessPredicate()) .writeAccessPredicate(getWriteAccessPredicate()) .hooks(hooks); if (null != getGraphAuths()) { builder.graphAuths(getGraphAuths().toArray(new String[getGraphAuths().size()])); } return builder.build(); }  @Override AddGraphWithHooks shallowClone(); GraphHook[] getHooks(); void setHooks(final GraphHook[] hooks);  }
@Test public void shouldShallowCloneOperationWithNulls() { final AddGraphWithHooks a = new Builder() .graphId(null) .parentPropertiesId(null) .parentSchemaIds(null) .schema(null) .graphAuths(null) .storeProperties(null) .readAccessPredicate(READ_ACCESS_PREDICATE) .writeAccessPredicate(WRITE_ACCESS_PREDICATE) .build(); final AddGraphWithHooks b = a.shallowClone(); assertEquals(a.getGraphId(), b.getGraphId()); assertEquals(a.getStoreProperties(), b.getStoreProperties()); assertEquals(a.getSchema(), b.getSchema()); assertEquals(a.getGraphAuths(), b.getGraphAuths()); assertEquals(a.getReadAccessPredicate(), b.getReadAccessPredicate()); assertEquals(a.getWriteAccessPredicate(), b.getWriteAccessPredicate()); }