2 * Copyright (c) 2016 Cisco Systems, Inc. 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.mdsal.common.api;
10 import static org.junit.jupiter.api.Assertions.assertEquals;
11 import static org.junit.jupiter.api.Assertions.assertNull;
13 import org.junit.jupiter.api.Test;
14 import org.opendaylight.yangtools.yang.common.ErrorTag;
15 import org.opendaylight.yangtools.yang.common.ErrorType;
17 class OptimisticLockFailedExceptionTest {
19 void optimisticLockFailedExceptionTest() {
20 final var ex = new OptimisticLockFailedException("test");
21 assertEquals("test", ex.getMessage());
22 final var errors = ex.getErrorList();
23 assertEquals(1, errors.size());
24 final var error = errors.get(0);
25 assertEquals(ErrorType.APPLICATION, error.getErrorType());
26 assertEquals(ErrorTag.RESOURCE_DENIED, error.getTag());
27 assertNull(error.getApplicationTag());
28 assertNull(error.getInfo());
29 assertNull(error.getCause());