Populate model/ hierarchy
[yangtools.git] / model / yang-model-api / src / test / java / org / opendaylight / yangtools / yang / model / api / stmt / ActionStatementAwareDeclaredStatementTest.java
1 /*
2  * Copyright (c) 2018 Pantheon Technologies, s.r.o. 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.model.api.stmt;
9
10 import static org.junit.Assert.assertEquals;
11 import static org.mockito.ArgumentMatchers.any;
12 import static org.mockito.Mockito.doCallRealMethod;
13 import static org.mockito.Mockito.doReturn;
14
15 import com.google.common.collect.ImmutableList;
16 import org.junit.Before;
17 import org.junit.Test;
18 import org.junit.runner.RunWith;
19 import org.mockito.Mock;
20 import org.mockito.junit.MockitoJUnitRunner;
21 import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement1;
22
23 @RunWith(MockitoJUnitRunner.StrictStubs.class)
24 public class ActionStatementAwareDeclaredStatementTest {
25     @Mock
26     public ActionStatementAwareDeclaredStatement<?> stmt;
27     @Mock
28     public DeclaredStatement1 stmt1;
29     @Mock
30     public ActionStatement stmt2;
31
32     @Before
33     public void before() {
34         doReturn(ImmutableList.of(stmt1, stmt2)).when(stmt).declaredSubstatements();
35         doCallRealMethod().when(stmt).declaredSubstatements(any());
36         doCallRealMethod().when(stmt).getActions();
37     }
38
39     @Test
40     public void testGetActions() {
41         assertEquals(ImmutableList.of(stmt2), ImmutableList.copyOf(stmt.getActions()));
42     }
43 }