Further cleanup of tests
[yangtools.git] / parser / yang-parser-rfc7950 / src / test / java / org / opendaylight / yangtools / yang / stmt / YT1133Test.java
1 /*
2  * Copyright (c) 2020 PANTHEON.tech, 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.stmt;
9
10 import static org.hamcrest.CoreMatchers.containsString;
11 import static org.hamcrest.CoreMatchers.not;
12 import static org.hamcrest.MatcherAssert.assertThat;
13 import static org.junit.Assert.assertEquals;
14
15 import java.io.ByteArrayOutputStream;
16 import java.io.PrintStream;
17 import java.nio.charset.StandardCharsets;
18 import org.junit.Test;
19 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
20
21 public class YT1133Test extends AbstractYangTest {
22     @Test
23     @SuppressWarnings("checkstyle:regexpSinglelineJava")
24     public void testAugmentKeys() throws Exception {
25         final PrintStream stdout = System.out;
26         final ByteArrayOutputStream output = new ByteArrayOutputStream();
27         final EffectiveModelContext ctx;
28
29         try (PrintStream out = new PrintStream(output, true, StandardCharsets.UTF_8)) {
30             System.setOut(out);
31             ctx = assertEffectiveModelDir("/bugs/YT1133");
32         } finally {
33             System.setOut(stdout);
34         }
35
36         assertEquals(2, ctx.getModules().size());
37         final String log = output.toString();
38         assertThat(log, not(containsString("Configuration list (bar)values")));
39     }
40 }