2 * Copyright (c) 2014 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
9 package org.opendaylight.openflowplugin.openflow.md.core;
11 import static org.mockito.Mockito.when;
13 import junit.framework.TestCase;
14 import org.junit.Before;
15 import org.junit.Test;
16 import org.mockito.MockitoAnnotations;
17 import org.opendaylight.openflowplugin.ConnectionException;
18 import org.opendaylight.openflowplugin.openflow.md.core.session.SessionContext;
19 import org.opendaylight.openflowplugin.openflow.md.core.session.SwitchSessionKeyOF;
21 public class ErrorHandlerSimpleImplTest extends TestCase {
23 ErrorHandler errorHandler = new ErrorHandlerSimpleImpl();
25 @MockitoAnnotations.Mock
26 SessionContext sessionContext;
28 @MockitoAnnotations.Mock
29 SwitchSessionKeyOF switchSessionKeyOF;
33 when(sessionContext.getSessionKey()).thenReturn(switchSessionKeyOF);
34 when(switchSessionKeyOF.getId()).thenReturn(new byte[0]);
38 public void testHandleException() throws Exception {
39 ConnectionException connectionException = new ConnectionException("Exception for testing purpose only.");
40 errorHandler.handleException(connectionException, sessionContext);
42 Exception someException = new Exception("Exception for testing purpose only.");
43 errorHandler.handleException(someException, sessionContext);