blob: a5417d1ced3ca586c4e66e5fcff4cccde6e30f90 [file] [log] [blame]
/*
* Copyright (c) 2012 Google Inc.
*
* All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse
* Public License v1.0 which accompanies this distribution, and is available at
*
* http://www.eclipse.org/legal/epl-v10.html
*/
package com.google.eclipse.protobuf.cdt.fqn;
import org.eclipse.xtext.naming.QualifiedName;
import org.hamcrest.*;
/**
* @author alruiz@google.com (Alex Ruiz)
*/
public class IsQualifiedNameSource extends BaseMatcher<Iterable<QualifiedName>> {
private final QualifiedName original;
public static IsQualifiedNameSource isQualifiedNameSourceWith(String[] segments) {
return new IsQualifiedNameSource(segments);
}
private IsQualifiedNameSource(String[] segments) {
original = QualifiedName.create(segments);
}
@Override public boolean matches(Object item) {
if (!(item instanceof QualifiedNameSource)) {
return false;
}
QualifiedNameSource source = (QualifiedNameSource) item;
return original.equals(source.original());
}
@Override public void describeTo(Description description) {
description.appendValue(QualifiedNameSource.class.getSimpleName() + " with original qualified name: " + original);
}
}