Rework body formatting wiring
[netconf.git] / restconf / restconf-nb / src / test / java / org / opendaylight / restconf / nb / jaxrs / RestconfYangLibraryVersionGetTest.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.restconf.nb.jaxrs;
9
10 import org.junit.jupiter.api.Test;
11 import org.junit.jupiter.api.extension.ExtendWith;
12 import org.mockito.junit.jupiter.MockitoExtension;
13 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
14 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
15
16 @ExtendWith(MockitoExtension.class)
17 class RestconfYangLibraryVersionGetTest extends AbstractRestconfTest {
18     @Override
19     EffectiveModelContext modelContext() {
20         return YangParserTestUtils.parseYangResourceDirectory("/restconf/impl");
21     }
22
23     @Test
24     void testLibraryVersion() {
25         final var body = assertFormattableBody(200, ar -> restconf.yangLibraryVersionGET(ar));
26
27         assertFormat("""
28             {"ietf-restconf:yang-library-version":"2019-01-04"}""", body::formatToJSON, false);
29         assertFormat("""
30             <yang-library-version xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf">2019-01-04\
31             </yang-library-version>""", body::formatToXML, false);
32     }
33 }