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
8 package org.opendaylight.yangtools.yang.stmt;
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertNotNull;
12 import static org.junit.Assert.assertTrue;
13 import static org.junit.Assert.fail;
16 import org.junit.Test;
17 import org.opendaylight.yangtools.yang.model.api.Deviation;
18 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
19 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
20 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
22 public class Bug4933Test {
25 public void test() throws Exception {
26 SchemaContext context = StmtTestUtils.parseYangSources("/bugs/bug4933/correct");
27 assertNotNull(context);
29 Set<Deviation> deviations = context.getModules().iterator().next().getDeviations();
30 assertEquals(4, deviations.size());
34 public void incorrectKeywordTest() throws Exception {
36 StmtTestUtils.parseYangSources("/bugs/bug4933/incorrect");
37 fail("ReactorException should be thrown.");
38 } catch (ReactorException e) {
39 final Throwable cause = e.getCause();
40 assertTrue(cause instanceof SourceException);
41 assertTrue(cause.getMessage().startsWith("String 'not_supported' is not valid deviate argument"));