2 * Copyright (c) 2023 PANTHEON.tech, s.r.o. and others. All rights reserved.
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
8 package org.opendaylight.restconf.openapi.impl;
10 import org.junit.jupiter.api.BeforeAll;
11 import org.junit.jupiter.api.Test;
12 import org.skyscreamer.jsonassert.JSONAssert;
14 public class ToasterDocumentTest extends AbstractDocumentTest {
15 private static final String TOASTER = "toaster";
16 private static final String TOASTER_REV = "2009-11-20";
19 public static void beforeClass() {
20 initializeClass("/toaster-document/");
24 * Tests the swagger document that is result of the call to the '/single' endpoint.
27 public void getAllModulesDocTest() throws Exception {
28 final var jsonControllerDoc = getAllModulesDoc();
29 final var expectedJson = getExpectedDoc("toaster-document/controller-all.json");
30 JSONAssert.assertEquals(expectedJson, jsonControllerDoc, IGNORE_ORDER);
34 * Tests the swagger document that is result of the call to the '/toaster(2009-11-20)' endpoint.
37 * Model toaster is used for test correct generating of complex openapi object.
40 public void getDocByModuleTest() throws Exception {
41 final var jsonControllerDoc = getDocByModule(TOASTER, TOASTER_REV);
42 final var expectedJson = getExpectedDoc("toaster-document/controller-toaster.json");
43 JSONAssert.assertEquals(expectedJson, jsonControllerDoc, IGNORE_ORDER);
47 * Tests the swagger document that is result of the call to the '/mounts/1' endpoint.
50 public void getMountDocTest() throws Exception {
51 final var jsonDeviceDoc = getMountDoc();
52 final var expectedJson = getExpectedDoc("toaster-document/device-all.json");
53 JSONAssert.assertEquals(expectedJson, jsonDeviceDoc, IGNORE_ORDER);
57 * Tests the swagger document that is result of the call to the '/mounts/1/toaster(2009-11-20)' endpoint.
60 * Model toaster is used for test correct generating of complex openapi object.
63 public void getMountDocByModuleTest() throws Exception {
64 final var jsonDeviceDoc = getMountDocByModule(TOASTER, TOASTER_REV);
65 final var expectedJson = getExpectedDoc("toaster-document/device-toaster.json");
66 JSONAssert.assertEquals(expectedJson, jsonDeviceDoc, IGNORE_ORDER);