2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.mdsal.singleton.dom.impl.util;
11 import com.google.common.base.Preconditions;
12 import com.google.common.collect.ImmutableList;
13 import java.util.LinkedList;
14 import java.util.List;
15 import org.opendaylight.yangtools.concepts.Path;
18 * Test helper class. {@link Path} for testing only
20 public class TestInstanceIdentifier implements Path<TestInstanceIdentifier> {
22 static final TestInstanceIdentifier EMPTY_INSTANCE = new TestInstanceIdentifier(ImmutableList.of());
24 private final ImmutableList<String> path;
26 public TestInstanceIdentifier(final Iterable<? extends TestInstanceIdentifier> path) {
27 Preconditions.checkArgument(path != null);
28 final List<String> tiis = new LinkedList<>();
29 for (final TestInstanceIdentifier t : path) {
30 tiis.add(t.toString());
32 this.path = ImmutableList.copyOf(tiis);
35 TestInstanceIdentifier(final String path) {
36 this.path = ImmutableList.of(path);
40 public boolean contains(final TestInstanceIdentifier other) {
41 return path.contains(other);