Remove unneeded throws
[yangtools.git] / parser / yang-parser-rfc7950 / src / test / java / org / opendaylight / yangtools / yang / stmt / ChoiceStmtTest.java
1 /*
2  * Copyright (c) 2016 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.yangtools.yang.stmt;
9
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertNotNull;
12
13 import org.junit.Test;
14 import org.opendaylight.yangtools.yang.model.api.CaseSchemaNode;
15 import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode;
16 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
17
18 public class ChoiceStmtTest extends AbstractModelTest {
19     @Test
20     public void choiceAndCaseTest() {
21         final ContainerSchemaNode container = (ContainerSchemaNode) FOO.getDataChildByName(fooQName("transfer"));
22         final ChoiceSchemaNode choice = (ChoiceSchemaNode) container.getDataChildByName(fooQName("how"));
23         assertEquals(5, choice.getCases().size());
24
25         CaseSchemaNode caseNode = choice.findCaseNodes("input").iterator().next();
26         assertNotNull(caseNode);
27         caseNode = choice.findCaseNodes("output").iterator().next();
28         assertNotNull(caseNode);
29         caseNode = choice.findCaseNodes("interval").iterator().next();
30         assertNotNull(caseNode);
31         caseNode = choice.findCaseNodes("daily").iterator().next();
32         assertNotNull(caseNode);
33         caseNode = choice.findCaseNodes("manual").iterator().next();
34         assertNotNull(caseNode);
35         assertEquals("interval", choice.getDefaultCase().get().getQName().getLocalName());
36     }
37 }