Parameters implements Cloneable, Serializable { public void set(final TraversalParent parent, final Object... keyValues) { if (keyValues.length % 2 != 0) throw Element.Exceptions.providedKeyValuesMustBeAMultipleOfTwo(); for (int ix = 0; ix < keyValues.length; ix = ix + 2) { if (!(keyValues[ix] instanceof String) && !(keyValues[ix] instanceof T) && !(keyValues[ix] instanceof Traversal)) throw new IllegalArgumentException("The provided key/value array must have a String, T, or Traversal on even array indices"); for (int iy = 0; iy < 2; iy++) { if (keyValues[ix + iy] instanceof Traversal.Admin) { final Traversal.Admin t = (Traversal.Admin) keyValues[ix + iy]; addTraversal(t); if (parent != null) parent.integrateChild(t); } } List<Object> values = this.parameters.get(keyValues[ix]); if (null == values) { values = new ArrayList<>(); values.add(keyValues[ix + 1]); this.parameters.put(keyValues[ix], values); } else { values.add(keyValues[ix + 1]); } } }  boolean contains(final Object key); boolean contains(final Object key, final Object value); void rename(final Object oldKey, final Object newKey); List<E> get(final Traverser.Admin<S> traverser, final Object key, final Supplier<E> defaultValue); List<E> get(final Object key, final Supplier<E> defaultValue); Object remove(final Object key); Object[] getKeyValues(final Traverser.Admin<S> traverser, final Object... exceptKeys); Map<Object, List<Object>> getRaw(final Object... exceptKeys); void set(final TraversalParent parent, final Object... keyValues); List<Traversal.Admin<S, E>> getTraversals(); Set<String> getReferencedLabels(); Parameters clone(); int hashCode(); String toString(); static final Parameters EMPTY; }
@Test public void shouldIntegrateTraversals() { final TraversalParent mock = mock(TraversalParent.class); final Parameters parameters = new Parameters(); when(mock.integrateChild(__.outE("knows").asAdmin())).thenReturn(null); parameters.set(mock, "a", "axe", "a", "ant", "b", "bat", "b", "ball", "c", "cat", "t", __.outE("knows")); verify(mock).integrateChild(__.outE("knows").asAdmin()); }