4572f4dc9c46c40f1ad61d0970ed39c447c9c7e4
[mdsal.git] / binding / mdsal-binding-generator / src / test / java / org / opendaylight / mdsal / binding / generator / impl / Bug4621Test.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.mdsal.binding.generator.impl;
9
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertThrows;
12
13 import org.junit.Test;
14 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
15 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
16
17 public class Bug4621Test {
18     @Test
19     public void testMissingLeafrefTarget() {
20         final EffectiveModelContext context = YangParserTestUtils.parseYangResource("/bug4621.yang");
21         final IllegalArgumentException ex = assertThrows(IllegalArgumentException.class,
22             () -> DefaultBindingGenerator.generateFor(context));
23         assertEquals("Failed to find leafref target /foo:neighbor/foo:mystring1", ex.getMessage());
24     }
25 }