70b876eacd85729f92c331fff3dea1d1dc7e561b
[yangtools.git] / yang / yang-common / src / test / java / org / opendaylight / yangtools / yang / common / OperationFailedExceptionTest.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  */
9
10 package org.opendaylight.yangtools.yang.common;
11
12 import static org.junit.Assert.assertEquals;
13 import static org.junit.Assert.assertTrue;
14
15 import org.junit.Test;
16
17 public class OperationFailedExceptionTest {
18
19     @Test
20     public void testOperationFailedException() {
21         final Throwable cause = new Throwable( "mock cause" );
22         final RpcError rpcErrorShort = RpcResultBuilder.newError(RpcError.ErrorType.RPC, "tag", "msg");
23         final OperationFailedException operationFailedException1 = new OperationFailedException("error msg", cause,
24                 rpcErrorShort);
25         final OperationFailedException operationFailedException2 = new OperationFailedException("error msg", rpcErrorShort);
26         assertEquals(operationFailedException1.getErrorList(), operationFailedException2.getErrorList());
27         assertTrue(operationFailedException1.toString().contains("error msg"));
28     }
29 }