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.common.spi.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;
27 * {@link TestInstanceIdentifier} constructor
31 public TestInstanceIdentifier(final Iterable<? extends TestInstanceIdentifier> path) {
32 Preconditions.checkArgument(path != null);
33 final List<String> tiis = new LinkedList<>();
34 for (final TestInstanceIdentifier t : path) {
35 tiis.add(t.toString());
37 this.path = ImmutableList.copyOf(tiis);
40 TestInstanceIdentifier(final String path) {
41 this.path = ImmutableList.of(path);
45 public boolean contains(final TestInstanceIdentifier other) {
46 return path.contains(other);