Rework body formatting wiring
[netconf.git] / restconf / restconf-nb / src / test / java / org / opendaylight / restconf / nb / rfc8040 / legacy / ErrorTagsTest.java
1 /*
2  * Copyright (c) 2021 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.restconf.nb.rfc8040.legacy;
9
10 import static org.junit.jupiter.api.Assertions.assertEquals;
11
12 import java.util.List;
13 import org.junit.jupiter.params.ParameterizedTest;
14 import org.junit.jupiter.params.provider.Arguments;
15 import org.junit.jupiter.params.provider.MethodSource;
16 import org.opendaylight.yangtools.yang.common.ErrorTag;
17
18 class ErrorTagsTest {
19     @ParameterizedTest(name = "{0} => {1}")
20     @MethodSource
21     void testStatusOf(final String tagName, final int status) {
22         assertEquals(status, ErrorTags.statusOf(new ErrorTag(tagName)).getStatusCode());
23     }
24
25     static List<Arguments> testStatusOf() {
26         return List.of(
27             Arguments.of("in-use", 409),
28             Arguments.of("invalid-value", 400),
29             Arguments.of("too-big", 413),
30             Arguments.of("missing-attribute", 400),
31             Arguments.of("bad-attribute", 400),
32             Arguments.of("unknown-attribute", 400),
33             Arguments.of("missing-element", 400),
34             Arguments.of("bad-element", 400),
35             Arguments.of("unknown-element", 400),
36             Arguments.of("unknown-namespace", 400),
37             Arguments.of("access-denied", 403),
38             Arguments.of("lock-denied", 409),
39             Arguments.of("resource-denied", 409),
40             Arguments.of("rollback-failed", 500),
41             Arguments.of("data-exists", 409),
42             Arguments.of("data-missing", 409),
43             Arguments.of("operation-not-supported", 501),
44             Arguments.of("operation-failed", 500),
45             Arguments.of("partial-operation", 500),
46             Arguments.of("malformed-message", 400),
47             Arguments.of("resource-denied-transport", 503));
48     }
49 }