use of org.eclipse.emf.ecore.util.EcoreAdapterFactory in project xtext-core by eclipse.
the class CompositeNodeTest method testIsAdapterForType.
@Test
public void testIsAdapterForType() {
EObject object = EcoreFactory.eINSTANCE.createEObject();
CompositeNodeWithSemanticElement node = createCompositeNode();
object.eAdapters().add(node);
AdapterFactory adapterFactory = new EcoreAdapterFactory();
Adapter adapter = adapterFactory.adapt(object, INode.class);
assertSame(node, adapter);
// the following line may not throw a ClassCastException
Adapter secondAdapter = adapterFactory.adapt(object, new Object());
assertNull(secondAdapter);
}
Aggregations