2 * Copyright (c) 2022 PANTHEON.tech, s.r.o. 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
8 package org.opendaylight.yangtools.yang.parser.repo;
10 import static org.hamcrest.CoreMatchers.instanceOf;
11 import static org.hamcrest.MatcherAssert.assertThat;
12 import static org.junit.Assert.assertEquals;
13 import static org.junit.Assert.assertThrows;
15 import com.google.common.util.concurrent.Futures;
16 import java.util.concurrent.ExecutionException;
17 import org.junit.Test;
18 import org.opendaylight.yangtools.yang.model.repo.api.RevisionSourceIdentifier;
19 import org.opendaylight.yangtools.yang.model.repo.api.SchemaResolutionException;
21 public class YT1428Test extends AbstractSchemaRepositoryTest {
23 public void testDeviateSourceReported() throws Exception {
24 final var future = createSchemaContext(null, "/yt1428/orig.yang", "/yt1428/deviate.yang");
25 final var cause = assertThrows(ExecutionException.class, () -> Futures.getDone(future)).getCause();
26 assertThat(cause, instanceOf(SchemaResolutionException.class));
27 assertEquals(RevisionSourceIdentifier.create("deviate"), ((SchemaResolutionException) cause).getFailedSource());